How to Get 97% Accuracy on the German Traffic Signs Validation Dataset


First load the data

In [1]:
# Import pickle files of train, validation, and test sets:
import pickle
import numpy as np
import pandas as pd

training_file = 'traffic-signs-data/train.p'
validation_file = 'traffic-signs-data/valid.p'
testing_file = 'traffic-signs-data/test.p'

with open(training_file, mode='rb') as f:
    train = pickle.load(f)
with open(validation_file, mode='rb') as f:
    valid = pickle.load(f)
with open(testing_file, mode='rb') as f:
    test = pickle.load(f)
    
X_train, y_train = train['features'], train['labels']
X_valid, y_valid = valid['features'], valid['labels']
X_test, y_test = test['features'], test['labels']

# Load sign names:
sign_names = pd.read_csv('signnames.csv')[['ClassId', 'SignName']].values

# Save original sizes and bounding-box coordinates (this will help during preprocessing):
train_sizes= train['sizes']
train_coord = train['coords']

valid_sizes= valid['sizes']
valid_coord = valid['coords']

test_sizes= test['sizes']
test_coord = test['coords']

Let's take a look at the basics

In [2]:
n_train = X_train.shape[0]
n_validation = X_valid.shape[0]
n_test = X_test.shape[0]
image_shape = X_train.shape[1:]
n_classes = len(np.unique(y_train))

print("Number of training examples =", n_train)
print("Number of validation examples =", n_validation)
print("Number of testing examples =", n_test)
print("Image data shape =", image_shape)
print("Number of classes =", n_classes)
Number of training examples = 34799
Number of validation examples = 4410
Number of testing examples = 12630
Image data shape = (32, 32, 3)
Number of classes = 43

Now let's check out the distribution of classes for each set

I like looking at the numbers rather than a graph. I find it easier to ingest the information, so that's what I'll do.

In [3]:
a, b = np.unique(y_train, return_counts=True)
print('Training Data:')
for i in range(len(a)):
    print('{:.20} occurs {} times or {:.0f}% of total'.format(sign_names[a[i], 1], b[i], (b[i]/np.sum(b))*100))
print('')
a, b = np.unique(y_valid, return_counts=True)
print('Validation Data:')
for i in range(len(a)):
    print('{:.20} occurs {} times or {:.0f}% of total'.format(sign_names[a[i], 1], b[i], (b[i]/np.sum(b))*100))
print('')  
a, b = np.unique(y_test, return_counts=True)
print('Test Data:')
for i in range(len(a)):
    print('{:.30} occurs {} times or {:.0f}% of total'.format(sign_names[a[i], 1], b[i], (b[i]/np.sum(b))*100))
Training Data:
Speed limit (20km/h) occurs 180 times or 1% of total
Speed limit (30km/h) occurs 1980 times or 6% of total
Speed limit (50km/h) occurs 2010 times or 6% of total
Speed limit (60km/h) occurs 1260 times or 4% of total
Speed limit (70km/h) occurs 1770 times or 5% of total
Speed limit (80km/h) occurs 1650 times or 5% of total
End of speed limit ( occurs 360 times or 1% of total
Speed limit (100km/h occurs 1290 times or 4% of total
Speed limit (120km/h occurs 1260 times or 4% of total
No passing occurs 1320 times or 4% of total
No passing for vehic occurs 1800 times or 5% of total
Right-of-way at the  occurs 1170 times or 3% of total
Priority road occurs 1890 times or 5% of total
Yield occurs 1920 times or 6% of total
Stop occurs 690 times or 2% of total
No vehicles occurs 540 times or 2% of total
Vehicles over 3.5 me occurs 360 times or 1% of total
No entry occurs 990 times or 3% of total
General caution occurs 1080 times or 3% of total
Dangerous curve to t occurs 180 times or 1% of total
Dangerous curve to t occurs 300 times or 1% of total
Double curve occurs 270 times or 1% of total
Bumpy road occurs 330 times or 1% of total
Slippery road occurs 450 times or 1% of total
Road narrows on the  occurs 240 times or 1% of total
Road work occurs 1350 times or 4% of total
Traffic signals occurs 540 times or 2% of total
Pedestrians occurs 210 times or 1% of total
Children crossing occurs 480 times or 1% of total
Bicycles crossing occurs 240 times or 1% of total
Beware of ice/snow occurs 390 times or 1% of total
Wild animals crossin occurs 690 times or 2% of total
End of all speed and occurs 210 times or 1% of total
Turn right ahead occurs 599 times or 2% of total
Turn left ahead occurs 360 times or 1% of total
Ahead only occurs 1080 times or 3% of total
Go straight or right occurs 330 times or 1% of total
Go straight or left occurs 180 times or 1% of total
Keep right occurs 1860 times or 5% of total
Keep left occurs 270 times or 1% of total
Roundabout mandatory occurs 300 times or 1% of total
End of no passing occurs 210 times or 1% of total
End of no passing by occurs 210 times or 1% of total

Validation Data:
Speed limit (20km/h) occurs 30 times or 1% of total
Speed limit (30km/h) occurs 240 times or 5% of total
Speed limit (50km/h) occurs 240 times or 5% of total
Speed limit (60km/h) occurs 150 times or 3% of total
Speed limit (70km/h) occurs 210 times or 5% of total
Speed limit (80km/h) occurs 210 times or 5% of total
End of speed limit ( occurs 60 times or 1% of total
Speed limit (100km/h occurs 150 times or 3% of total
Speed limit (120km/h occurs 150 times or 3% of total
No passing occurs 150 times or 3% of total
No passing for vehic occurs 210 times or 5% of total
Right-of-way at the  occurs 150 times or 3% of total
Priority road occurs 210 times or 5% of total
Yield occurs 240 times or 5% of total
Stop occurs 90 times or 2% of total
No vehicles occurs 90 times or 2% of total
Vehicles over 3.5 me occurs 60 times or 1% of total
No entry occurs 120 times or 3% of total
General caution occurs 120 times or 3% of total
Dangerous curve to t occurs 30 times or 1% of total
Dangerous curve to t occurs 60 times or 1% of total
Double curve occurs 60 times or 1% of total
Bumpy road occurs 60 times or 1% of total
Slippery road occurs 60 times or 1% of total
Road narrows on the  occurs 30 times or 1% of total
Road work occurs 150 times or 3% of total
Traffic signals occurs 60 times or 1% of total
Pedestrians occurs 30 times or 1% of total
Children crossing occurs 60 times or 1% of total
Bicycles crossing occurs 30 times or 1% of total
Beware of ice/snow occurs 60 times or 1% of total
Wild animals crossin occurs 90 times or 2% of total
End of all speed and occurs 30 times or 1% of total
Turn right ahead occurs 90 times or 2% of total
Turn left ahead occurs 60 times or 1% of total
Ahead only occurs 120 times or 3% of total
Go straight or right occurs 60 times or 1% of total
Go straight or left occurs 30 times or 1% of total
Keep right occurs 210 times or 5% of total
Keep left occurs 30 times or 1% of total
Roundabout mandatory occurs 60 times or 1% of total
End of no passing occurs 30 times or 1% of total
End of no passing by occurs 30 times or 1% of total

Test Data:
Speed limit (20km/h) occurs 60 times or 0% of total
Speed limit (30km/h) occurs 720 times or 6% of total
Speed limit (50km/h) occurs 750 times or 6% of total
Speed limit (60km/h) occurs 450 times or 4% of total
Speed limit (70km/h) occurs 660 times or 5% of total
Speed limit (80km/h) occurs 630 times or 5% of total
End of speed limit (80km/h) occurs 150 times or 1% of total
Speed limit (100km/h) occurs 450 times or 4% of total
Speed limit (120km/h) occurs 450 times or 4% of total
No passing occurs 480 times or 4% of total
No passing for vehicles over 3 occurs 660 times or 5% of total
Right-of-way at the next inter occurs 420 times or 3% of total
Priority road occurs 690 times or 5% of total
Yield occurs 720 times or 6% of total
Stop occurs 270 times or 2% of total
No vehicles occurs 210 times or 2% of total
Vehicles over 3.5 metric tons  occurs 150 times or 1% of total
No entry occurs 360 times or 3% of total
General caution occurs 390 times or 3% of total
Dangerous curve to the left occurs 60 times or 0% of total
Dangerous curve to the right occurs 90 times or 1% of total
Double curve occurs 90 times or 1% of total
Bumpy road occurs 120 times or 1% of total
Slippery road occurs 150 times or 1% of total
Road narrows on the right occurs 90 times or 1% of total
Road work occurs 480 times or 4% of total
Traffic signals occurs 180 times or 1% of total
Pedestrians occurs 60 times or 0% of total
Children crossing occurs 150 times or 1% of total
Bicycles crossing occurs 90 times or 1% of total
Beware of ice/snow occurs 150 times or 1% of total
Wild animals crossing occurs 270 times or 2% of total
End of all speed and passing l occurs 60 times or 0% of total
Turn right ahead occurs 210 times or 2% of total
Turn left ahead occurs 120 times or 1% of total
Ahead only occurs 390 times or 3% of total
Go straight or right occurs 120 times or 1% of total
Go straight or left occurs 60 times or 0% of total
Keep right occurs 690 times or 5% of total
Keep left occurs 90 times or 1% of total
Roundabout mandatory occurs 90 times or 1% of total
End of no passing occurs 60 times or 0% of total
End of no passing by vehicles  occurs 90 times or 1% of total

Nothing too surprising. The distributions look similar. In all three sets, some signs occur more than others. Some of the notable ones are speed-limit, priority road, and yield signs.

Time to look at actual signs

I'll start by printing 80 random signs from each set.

In [4]:
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
In [5]:
ii = 1
idx = np.arange(n_train)
np.random.shuffle(idx)
plt.figure(figsize=(45, 45))
for i in range(10*8):
    plt.subplot(2*4,5*2,(i+1))
    plt.title('{:.20}'.format(sign_names[y_train[idx[i*ii]], 1]), fontsize=22)
    plt.imshow(X_train[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
In [6]:
ii = 1
idx = np.arange(n_validation)
np.random.shuffle(idx)
plt.figure(figsize=(45, 45))
for i in range(10*8):
    plt.subplot(2*4,5*2,(i+1))
    plt.title('{:.33}'.format(sign_names[y_valid[idx[i*ii]], 1]), fontsize=22)
    plt.imshow(X_valid[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
In [7]:
ii = 1
idx = np.arange(n_test)
np.random.shuffle(idx)
plt.figure(figsize=(45, 45))
for i in range(10*8):
    plt.subplot(2*4,5*2,(i+1))
    plt.title('{:.33}'.format(sign_names[y_test[idx[i*ii]], 1]), fontsize=22)
    plt.imshow(X_test[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')

There are lots of repeats in the training set . . .

In [8]:
plt.figure(figsize=(15,15))
for i in range(9):
    plt.subplot(3,3,(i+1))
    plt.imshow(X_train[4200+i])
    plt.title(sign_names[y_train[4200+i], 1])

. . . as well as in the validation set

As it happens, the below sign was the most misclassified sign for a network that I ran for 200 epochs and achieved a validation accuracy over 95%. Too bad it repeats many times within the validaiton set, so the one mistake counts as 10+ mistakes :(

In [9]:
plt.figure(figsize=(15,15))
for i in range(9):
    plt.subplot(3,3,(i+1))
    plt.imshow(X_valid[540+i])
    plt.title(sign_names[y_valid[540+i], 1])

How to preprocess the data?

The first five functions augment the training data and are not applied during test time on the validation or test sets. They are applied randomly to each image in each batch so the network never sees the exact same image twice, even if there are repeats :)

random_blur: Applies a Gaussian Noise kernel 50% of time

random_brighten: After noticing that signs in all sets had varying degrees of brightness, which didn't seem to be related to natural light conditions, I used this to randomly brighten or darken an image in a way to resemble images in the validation and test sets. I found out about OpenCV's lookup table from this tutorial.

random_red_adjust: This is poorly named because it adjusts all three color channels. It started out only affecting the red channel, but seemed to help the network generalize, so evolved.

random_rotate: Self-explanatory. I don't flip images and only rotate them by a max of 40 degrees because certain signs, like Left Turn Ahead and speed-limit signs, would confuse the network if flipped.

random_crop: Self-explanatory.

The only preprocessing normalization is to scale the data between 0 and 1.

Since bounding boxes are included, every image is cropped to include only the region within the box and resized to 32x32x3 for uniformity.

Images are kept in color because networks trained on RGB-images performed better for me than those on grayscale. Intuitively, this makes sense because street signs are designed to be different in three ways: shape, images and/or text, and color.

In [10]:
import cv2
import matplotlib.image as mpimg
In [11]:
def random_blur(x, kernel_size=3):
    blur = np.random.randint(1,3)
    if blur == 1:
        return cv2.GaussianBlur(x, (kernel_size, kernel_size), 0)
    if blur == 2:
        return x
    
def random_brighten(x):
    dark = np.random.randint(1,3)
    if dark == 1:
        gamma = np.random.random() * 0.7 + 0.3
    if dark == 2:
        gamma = np.random.random() * 3.5 + 1.1
    invGamma = 1.0 / gamma
    table = np.array([((i / 255.0) ** invGamma) * 255 for i in np.arange(0, 256)]).astype("uint8")
    return cv2.LUT(x, table)

def random_red_adjust(x):    
    R = np.random.random() * 0.3 + 0.7
    G = np.random.random() * 0.3 + 0.7
    B = np.random.random() * 0.3 + 0.7
    x[:,:,0] *= R
    x[:,:,1] *= G
    x[:,:,2] *= B
    return x

def random_rotate(x):
    degrees = int((np.random.rand() * 80) - 40)
    rows = x.shape[0]
    cols = x.shape[1]
    M = cv2.getRotationMatrix2D((cols/2,rows/2),degrees,1)
    dst = cv2.warpAffine(x,M,(cols,rows))
    return dst

def random_crop(x):
    n = int(x.shape[0] * 0.2)
    m = int(x.shape[1] * 0.2)
    x1 = np.random.randint(n)
    x2 = np.random.randint(n)
    y1 = np.random.randint(m)
    y2 = np.random.randint(m)
    crop = x[x1:x.shape[1]-x2, y1:x.shape[1]-y2]
    out = cv2.resize(crop, dsize=(32,32))
    return out

def normalize(x):
    return x / 255.

def region_of_interest_train(images, sizes, coords):
    # the reason for the try statement is to ignore illogical bounding boxes or images lacking them
    # the reason for the two if statements is to distinguish between inputs of batch_size and one image
    images_roi = []
    if len(images.shape) == 4:
        for i in range(images.shape[0]):
            try:
                orig_shape = images[i].shape
                resize = cv2.resize(images[i], dsize=tuple(sizes[i]))
                crop = resize[coords[i][0]:coords[i][2], coords[i][1]:coords[i][3], :]
                rand_crop = random_crop(crop)
                rand_bri = random_brighten(rand_crop)
                rand_rot = random_rotate(rand_bri)
                rand_blu = random_blur(rand_rot)
                resize2 = cv2.resize(rand_blu, dsize=tuple(orig_shape[:2]))
                norm = normalize(resize2)
                out = random_red_adjust(norm)
                images_roi.append(out)
            except:
                images_roi.append(normalize(images[i]))
                
    if len(images.shape) == 3:
        orig_shape = images.shape
        resize = cv2.resize(images, dsize=tuple(sizes))
        crop = resize[coords[0]:coords[2], coords[1]:coords[3], :]
        rand_crop = random_crop(crop)
        rand_bri = random_brighten(rand_crop)
        rand_rot = random_rotate(rand_bri)
        rand_blu = random_blur(rand_rot)
        resize2 = cv2.resize(rand_blu, dsize=tuple(orig_shape[:2]))
        norm = normalize(resize2)
        out = random_red_adjust(norm)
        images_roi.append(out)
    return np.array(images_roi)

def get_batches_train(images, labels, sign_names, sizes, coords, batch_num):
    num_images = len(images)
    idx = np.arange(num_images)
    np.random.shuffle(idx)
    for i in range(0, num_images, batch_num):
        batch_y = labels[idx[i:i+batch_num]]
        batch_sizes = sizes[idx[i:i+batch_num]]
        batch_coords = coords[idx[i:i+batch_num]]
        batch_names = sign_names[batch_y, 1]
        images_x = images[idx[i:i+batch_num]]
        batch_x = region_of_interest_train(images_x, batch_sizes, batch_coords).reshape((-1, 32, 32, 3))
        yield batch_x, batch_y, batch_names, batch_sizes, batch_coords

# Seperate get_batches and region_of_interest for test and validation without data augmentation
def region_of_interest_test(images, sizes, coords):
    images_roi = []
    if len(images.shape) == 4:
        for i in range(images.shape[0]):
            try:
                orig_shape = images[i].shape
                resize = cv2.resize(images[i], dsize=tuple(sizes[i]))
                crop = resize[coords[i][0]:coords[i][2], coords[i][1]:coords[i][3], :]
                out = cv2.resize(crop, dsize=tuple(orig_shape[:2]))
                images_roi.append(normalize(out))
            except:
                images_roi.append(normalize(images[i]))
                
    if len(images.shape) == 3:
        orig_shape = images.shape
        resize = cv2.resize(images, dsize=tuple(sizes))
        crop = resize[coords[0]:coords[2], coords[1]:coords[3], :]
        out = cv2.resize(crop, dsize=tuple(orig_shape[:2]))
        images_roi.append(normalize(out))
    return np.array(images_roi)

def get_batches_test(images, labels, sign_names, sizes, coords, batch_num):
    num_images = len(images)
    for i in range(0, num_images, batch_num):
        idx = np.arange(i,i+batch_num)
        batch_y = labels[i:i+batch_num]
        batch_sizes = sizes[i:i+batch_num]
        batch_coords = coords[i:i+batch_num]
        batch_names = sign_names[batch_y, 1]
        images_x = images[i:i+batch_num]
        batch_x = region_of_interest_test(images_x, batch_sizes, batch_coords).reshape((-1, 32, 32, 3))
        yield idx, batch_x, batch_y, batch_names, batch_sizes, batch_coords

Here's what one image looks like when preprocessed eight times

In [12]:
x = X_train[267]
y = y_train[267]
x_name = sign_names[y]
x_coord = train_coord[267]
x_size = train_sizes[267]
x_resize = cv2.resize(x, dsize=tuple(x_size))
plt.figure(figsize=((15,15)))
plt.suptitle(x_name[1], fontsize=20, y=0.91)
plt.subplot(3,3,1)
plt.title('ORIGINAL')
plt.imshow(x)
for i in range(2,10):
    plt.subplot(3,3,i)
    plt.imshow(region_of_interest_train(x, x_size, x_coord).reshape((32,32,3)))

Now compare 10 images from each set before and after preprocessing

Only the train images are randomly augmented, but we'll look at all three sets to make sure everything works properly.

In [13]:
train_roi = region_of_interest_train(X_train, train_sizes, train_coord)
valid_roi = region_of_interest_test(X_valid, valid_sizes, valid_coord)
test_roi = region_of_interest_test(X_test, test_sizes, test_coord)
In [14]:
ii = 3
idx = np.arange(n_train)
np.random.shuffle(idx)
plt.figure(figsize=(15, 6))
plt.suptitle('Train Before', fontsize=16)
for i in range(10):
    plt.subplot(2,5,(i+1))
    plt.title('{:.33}'.format(sign_names[y_train[idx[i*ii]], 1]))
    plt.imshow(X_train[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
    
plt.figure(figsize=(15, 6))
plt.suptitle('Train After', fontsize=16)
for i in range(10):
    plt.subplot(2,5,(i+1))
    plt.title('{:.33}'.format(sign_names[y_train[idx[i*ii]], 1]))
    plt.imshow(train_roi[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
In [15]:
ii = 3
idx = np.arange(n_validation)
np.random.shuffle(idx)
plt.figure(figsize=(15, 6))
plt.suptitle('Validation Before', fontsize=16)
for i in range(10):
    plt.subplot(2,5,(i+1))
    plt.title('{:.33}'.format(sign_names[y_valid[idx[i*ii]], 1]))
    plt.imshow(X_valid[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
    
plt.figure(figsize=(15, 6))
plt.suptitle('Validation After', fontsize=16)
for i in range(10):
    plt.subplot(2,5,(i+1))
    plt.title('{:.33}'.format(sign_names[y_valid[idx[i*ii]], 1]))
    plt.imshow(valid_roi[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
In [16]:
ii = 3
idx = np.arange(n_test)
np.random.shuffle(idx)
plt.figure(figsize=(15, 6))
plt.suptitle('Test Before', fontsize=16)
for i in range(10):
    plt.subplot(2,5,(i+1))
    plt.title('{:.33}'.format(sign_names[y_test[idx[i*ii]], 1]))
    plt.imshow(X_test[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
    
plt.figure(figsize=(15, 6))
plt.suptitle('Test After', fontsize=16)
for i in range(10):
    plt.subplot(2,5,(i+1))
    plt.title('{:.33}'.format(sign_names[y_test[idx[i*ii]], 1]))
    plt.imshow(test_roi[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')

I find it useful to see a bunch of images at once, so here's what 80 preprocessed images from each set look like

In [17]:
ii = 1
idx = np.arange(n_train)
np.random.shuffle(idx)
plt.figure(figsize=(45, 45))
plt.suptitle('80 Train', fontsize=50, y=0.91)
for i in range(10*8):
    plt.subplot(2*4,5*2,(i+1))
    plt.title('{:.20}'.format(sign_names[y_train[idx[i*ii]], 1]), fontsize=22)
    plt.imshow(train_roi[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
In [18]:
ii = 1
idx = np.arange(n_validation)
np.random.shuffle(idx)
plt.figure(figsize=(45, 45))
plt.suptitle('80 Validation', fontsize=50, y=0.91)
for i in range(10*8):
    plt.subplot(2*4,5*2,(i+1))
    plt.title('{:.33}'.format(sign_names[y_valid[idx[i*ii]], 1]), fontsize=22)
    plt.imshow(valid_roi[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
In [19]:
ii = 1
idx = np.arange(n_test)
np.random.shuffle(idx)
plt.figure(figsize=(45, 45))
plt.suptitle('80 Test', fontsize=50, y=0.91)
for i in range(10*8):
    plt.subplot(2*4,5*2,(i+1))
    plt.title('{:.33}'.format(sign_names[y_test[idx[i*ii]], 1]), fontsize=22)
    plt.imshow(test_roi[idx[i*ii]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')

Build the brain!

In [20]:
import tensorflow as tf
from collections import namedtuple
In [21]:
def build_network(n_classes, batch_num, size_mult=64, alpha=0.2):
    tf.reset_default_graph()
    
    drop_rate = tf.placeholder(tf.float32, name='drop_rate')
    is_train = tf.placeholder(tf.bool, name='is_train')
    learn_rate = tf.placeholder(tf.float32, name='learn_rate')
    
    with tf.name_scope('inputs'):
        x = tf.placeholder(tf.float32, [None, 32, 32, 3], name='inputs')
    
    with tf.name_scope('targets'):
        targets = tf.placeholder(tf.int32, [None])
        y_one_hot = tf.one_hot(targets, n_classes, name='y_one_hot')
        y_reshaped = tf.reshape(y_one_hot, [-1, n_classes])
        
    with tf.name_scope('CONV1'):
        x1 = tf.layers.conv2d(x, 2*size_mult, 5, strides=1, padding='same', use_bias=True, name='conv1')
        relu1 = tf.maximum(alpha * x1, x1)
        
    with tf.name_scope('CONV2'):
        x2 = tf.layers.conv2d(relu1, 2*size_mult, 5, strides=2, padding='same', use_bias=True, name='conv2')
        relu2 = tf.maximum(alpha * x2, x2)
        
    with tf.name_scope('CONV3'):
        x3 = tf.layers.conv2d(relu2, 4*size_mult, 5, strides=1, padding='same', use_bias=False, name='conv3')
        bn3 = tf.layers.batch_normalization(x3, training=is_train, name='batch3')
        relu3 = tf.maximum(alpha * bn3, bn3)
        do3 = tf.layers.dropout(relu3, rate=drop_rate)
        
    with tf.name_scope('CONV4'):
        x4 = tf.layers.conv2d(do3, 4*size_mult, 5, strides=2, padding='same', use_bias=True, name='conv4')
        relu4 = tf.maximum(alpha * x4, x4)
        
    with tf.name_scope('CONV5'):   
        x5 = tf.layers.conv2d(relu4, 8*size_mult, 3, strides=1, padding='same', use_bias=True, name='conv5')
        relu5 = tf.maximum(alpha * x5, x5)
        do5 = tf.layers.dropout(relu5, rate=drop_rate)
        
    with tf.name_scope('CONV6'):
        x6 = tf.layers.conv2d(do5, 8*size_mult, 3, strides=2, padding='same', use_bias=True, name='conv6')
        relu6 = tf.maximum(alpha * x6, x6)
    
    with tf.name_scope('CONV7'):
        x7 = tf.layers.conv2d(relu6, 8*size_mult, 3, strides=1, padding='same', use_bias=False, name='conv7')
        bn7 = tf.layers.batch_normalization(x7, training=is_train, name='batch7')
        relu7 = tf.maximum(alpha * bn7, bn7)
        do7 = tf.layers.dropout(relu7, rate=drop_rate)
        
    with tf.name_scope('FC8'):
        x8 = tf.contrib.layers.flatten(do7)
        fc8 = tf.layers.dense(x8, 16 * size_mult, use_bias=True, activation=None, name='fc8')
        relu8 = tf.maximum(alpha * fc8, fc8)
        do8 = tf.layers.dropout(relu8, rate=drop_rate)
        
    with tf.name_scope('logits'):
        logits = tf.layers.dense(do8, n_classes, use_bias=True, activation=None, name='logits')
    
    with tf.name_scope('predictions'):
        preds = tf.nn.softmax(logits, name='predictions')
        correct_pred = tf.equal(tf.argmax(logits, 1), tf.argmax(y_reshaped, 1))
        accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32), name='accuracy')
    
    with tf.name_scope('cost'):
        cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=y_reshaped), name='cost')
    
    with tf.name_scope('train'):
        train_opt = tf.train.AdamOptimizer(learn_rate).minimize(cost)
    
    export_nodes = ['x', 'targets', 'drop_rate', 'is_train', 'learn_rate', 'relu1', 'relu2', 'relu3',
                    'relu4', 'relu5', 'relu6', 'relu7', 'correct_pred', 'preds', 'cost', 'accuracy', 'train_opt']
    Graph = namedtuple('Graph', export_nodes)
    local_dict = locals()
    graph = Graph(*[local_dict[each] for each in export_nodes])
    
    return graph

Here's a couple functions that will allow us to view sample validation images and the network's top-5 softmax probabilities for them during training

In [22]:
how_many = 5

def top_n_predictions(pred, top_n=how_many, probs_off=True):
    values, indices = tf.nn.top_k(pred, k=top_n)
    val = np.squeeze(values.eval()).tolist()
    ind = np.squeeze(indices.eval()).tolist()
    if probs_off:
        out = sign_names[ind, 1]
    else:
        out = val
    
    return out

def view_val_with_preds(sess, image, label, sign_name, size, coord, top_n=how_many):
    sample_x = region_of_interest_test(image, size, coord)
    
    feed = {model.x: sample_x.reshape((1,32,32,-1)), 
            model.targets: label.reshape((1,)), 
            model.drop_rate: 0., 
            model.is_train: False}
    pred = sess.run(model.preds, feed_dict=feed)
    top_n_pred_names = top_n_predictions(pred)
    top_n_pred_probs = top_n_predictions(pred, probs_off=False)
    
    plt.figure(figsize=(10, 8))
    plt.suptitle('{:.33}'.format(sign_name), fontsize=16)
        
    plt.subplot(2,2,1)
    y_pos = np.arange(top_n)
    probabilities = np.flip(top_n_pred_probs, 0)
    plt.barh(y_pos, probabilities, align='center', color='blue', tick_label=np.flip(top_n_pred_names, 0))
    plt.tick_params(axis='x', which='both', bottom='off', top='off', labelbottom='off')
    plt.xlabel('Probability')
    
    plt.subplot(2,2,2)
    plt.imshow(image)
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
        
    plt.subplots_adjust(wspace=0.75)
    plt.show()

Set hyperparameters and create some useful lists

In [23]:
epochs = 103
batch_size = 32
dropout_rate = 0.4
learn_rate = 0.0001
model = build_network(n_classes, learn_rate, batch_size)
saver = tf.train.Saver()
n_batches = int(n_train/batch_size)
steps = 0
train_losses, batch_accs = [], []
total_wrong_indexes = []
print_every = 200
new_val_acc = 0

Learn!

I find it useful to keep an eye on the network as it trains and to offer words of encouragement. Intuitively, this doesn't make sense. But, like dropout, it works well in practice.

In [24]:
with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    for e in range(epochs):
        for x, y, _, _, _  in get_batches_train(X_train, y_train, sign_names, train_sizes, train_coord, batch_size):
            steps += 1
            feed = {model.x: x, 
                    model.targets: y, 
                    model.drop_rate: dropout_rate, 
                    model.is_train: True, 
                    model.learn_rate: learn_rate}
            batch_acc, batch_loss, _ = sess.run([model.accuracy, model.cost, model.train_opt], feed_dict=feed)
            train_losses.append(batch_loss)
            batch_accs.append(batch_acc)
            
            if steps % print_every == 0:
                avg_loss = np.mean(train_losses)
                avg_acc = np.mean(batch_accs)
                print('Epoch {}/{}. . . Train Loss {:.4}. . . Train Acc {:.4}'.format(e+1, epochs, avg_loss, avg_acc))

        print('')
        print('Caclulating loss & accuracy on validation set...')
        val_losses, val_accs, wrong_indexes = [], [], []
        for val_idx, val_x, val_y, val_names, _, _  in get_batches_test(X_valid, y_valid, sign_names, 
                                                          valid_sizes, valid_coord, batch_size):
            feed = {model.x: val_x, 
                    model.targets: val_y, 
                    model.drop_rate: 0., 
                    model.is_train: False}
            val_acc, val_cor, val_loss = sess.run([model.accuracy, model.correct_pred, model.cost], feed_dict=feed)
            wrong_idx = [val_idx[i] for i in range(len(val_cor)) if val_cor[i] == False]
            wrong_indexes.append(wrong_idx)
            val_losses.append(val_loss)
            val_accs.append(val_acc)
        avg_val_loss = np.mean(val_losses)
        avg_val_acc = np.mean(val_accs)
        print('Epoch {}/{}. . . Val Loss {:.4}. . . Val Acc {:.4}'.format(e+1, epochs, avg_val_loss, avg_val_acc))
        # Save only checkpoints with a validation accuracy over 90%
        if avg_val_acc > 0.90:
            if new_val_acc == 0:
                !mkdir checks
            if avg_val_acc > new_val_acc:
                new_val_acc = avg_val_acc
                saver.save(sess, './checks/tsigns.ckpt')
                print('Model Saved!')
        print('')
        
        wrong_indexes = np.array([p for sublist in wrong_indexes for p in sublist])
        ind, cnt = np.unique(y_valid[wrong_indexes], return_counts=True)
        wrong_names = [sign_names[ind[i], 1] for i in range(len(ind))]
        for i in range(len(cnt)):
            # Only print sign names of those wrong 5% or more of time
            if (cnt[i]/np.sum(cnt))*100 > 4.9:
                print('<{:.20}> is {:.0f}% of total wrong'.format(wrong_names[i], (cnt[i]/np.sum(cnt))*100))
        print('')
        total_wrong_indexes.append(wrong_indexes)
        
        # Every 10 epochs, let's look at some validation images and the top-5 predicted labels
        if (e+1) % 10 == 0:
            print('Displaying validation samples...')
            num_images = len(X_valid)
            idx = np.arange(num_images)
            np.random.shuffle(idx)
            num_show = 5
            [view_val_with_preds(sess, X_valid[idx[i]], y_valid[idx[i]], sign_names[y_valid[idx[i]], 1], 
                                 valid_sizes[idx[i]], valid_coord[idx[i]]) for i in range(num_show)]
        
        #delete above and use below to only view images that were misclassified:
        #num_images = len(wrong_indexes)
        #idx = np.arange(num_images)
        #np.random.shuffle(idx)
        #num_show = 10
        #[view_val_with_preds(sess, X_valid[wrong_indexes[idx[i]]], y_valid[wrong_indexes[idx[i]]], 
        #                     sign_names[y_valid[wrong_indexes[idx[i]]], 1], valid_sizes[wrong_indexes[idx[i]]], 
        #                     valid_coord[wrong_indexes[idx[i]]]) for i in range(num_show)]
        
        
    print('Model finished training :)')
Epoch 1/103. . . Train Loss 2.765. . . Train Acc 0.2619
Epoch 1/103. . . Train Loss 2.224. . . Train Acc 0.3864
Epoch 1/103. . . Train Loss 1.895. . . Train Acc 0.4705
Epoch 1/103. . . Train Loss 1.662. . . Train Acc 0.5325
Epoch 1/103. . . Train Loss 1.495. . . Train Acc 0.5766

Caclulating loss & accuracy on validation set...
Epoch 1/103. . . Val Loss 3.731. . . Val Acc 0.4745

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (100km/h> is 5% of total wrong
<Speed limit (120km/h> is 6% of total wrong
<Right-of-way at the > is 6% of total wrong

Epoch 2/103. . . Train Loss 1.353. . . Train Acc 0.6146
Epoch 2/103. . . Train Loss 1.241. . . Train Acc 0.646
Epoch 2/103. . . Train Loss 1.147. . . Train Acc 0.672
Epoch 2/103. . . Train Loss 1.067. . . Train Acc 0.6942
Epoch 2/103. . . Train Loss 1.001. . . Train Acc 0.7129

Caclulating loss & accuracy on validation set...
Epoch 2/103. . . Val Loss 3.717. . . Val Acc 0.4343

<Speed limit (30km/h)> is 9% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 5% of total wrong
<Speed limit (100km/h> is 5% of total wrong
<No passing> is 5% of total wrong
<No passing for vehic> is 6% of total wrong
<Road work> is 5% of total wrong

Epoch 3/103. . . Train Loss 0.9416. . . Train Acc 0.7298
Epoch 3/103. . . Train Loss 0.8905. . . Train Acc 0.7442
Epoch 3/103. . . Train Loss 0.8447. . . Train Acc 0.7573
Epoch 3/103. . . Train Loss 0.8052. . . Train Acc 0.7683
Epoch 3/103. . . Train Loss 0.7706. . . Train Acc 0.7783
Epoch 3/103. . . Train Loss 0.7395. . . Train Acc 0.787

Caclulating loss & accuracy on validation set...
Epoch 3/103. . . Val Loss 3.696. . . Val Acc 0.6637

<Speed limit (30km/h)> is 14% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (120km/h> is 7% of total wrong
<Road work> is 8% of total wrong

Epoch 4/103. . . Train Loss 0.7097. . . Train Acc 0.7954
Epoch 4/103. . . Train Loss 0.6825. . . Train Acc 0.8032
Epoch 4/103. . . Train Loss 0.6594. . . Train Acc 0.8098
Epoch 4/103. . . Train Loss 0.6382. . . Train Acc 0.8159
Epoch 4/103. . . Train Loss 0.618. . . Train Acc 0.8217

Caclulating loss & accuracy on validation set...
Epoch 4/103. . . Val Loss 3.674. . . Val Acc 0.5211

<Speed limit (30km/h)> is 11% of total wrong
<Speed limit (50km/h)> is 9% of total wrong
<Speed limit (70km/h)> is 6% of total wrong
<Speed limit (120km/h> is 7% of total wrong
<Road work> is 7% of total wrong

Epoch 5/103. . . Train Loss 0.5989. . . Train Acc 0.8271
Epoch 5/103. . . Train Loss 0.5804. . . Train Acc 0.8323
Epoch 5/103. . . Train Loss 0.5648. . . Train Acc 0.8369
Epoch 5/103. . . Train Loss 0.5494. . . Train Acc 0.8414
Epoch 5/103. . . Train Loss 0.5353. . . Train Acc 0.8454
Epoch 5/103. . . Train Loss 0.5217. . . Train Acc 0.8493

Caclulating loss & accuracy on validation set...
Epoch 5/103. . . Val Loss 3.619. . . Val Acc 0.6748

<Speed limit (30km/h)> is 12% of total wrong
<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 7% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Road work> is 10% of total wrong

Epoch 6/103. . . Train Loss 0.5091. . . Train Acc 0.8529
Epoch 6/103. . . Train Loss 0.4971. . . Train Acc 0.8563
Epoch 6/103. . . Train Loss 0.4858. . . Train Acc 0.8594
Epoch 6/103. . . Train Loss 0.4754. . . Train Acc 0.8624
Epoch 6/103. . . Train Loss 0.4654. . . Train Acc 0.8653

Caclulating loss & accuracy on validation set...
Epoch 6/103. . . Val Loss 3.605. . . Val Acc 0.5226

<Speed limit (30km/h)> is 10% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (60km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 5% of total wrong
<Speed limit (120km/h> is 7% of total wrong
<Right-of-way at the > is 5% of total wrong
<Road work> is 6% of total wrong

Epoch 7/103. . . Train Loss 0.4561. . . Train Acc 0.868
Epoch 7/103. . . Train Loss 0.4472. . . Train Acc 0.8706
Epoch 7/103. . . Train Loss 0.4385. . . Train Acc 0.8731
Epoch 7/103. . . Train Loss 0.4303. . . Train Acc 0.8754
Epoch 7/103. . . Train Loss 0.4226. . . Train Acc 0.8776
Epoch 7/103. . . Train Loss 0.4149. . . Train Acc 0.8798

Caclulating loss & accuracy on validation set...
Epoch 7/103. . . Val Loss 3.41. . . Val Acc 0.6673

<Speed limit (30km/h)> is 9% of total wrong
<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (70km/h)> is 8% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<Road work> is 9% of total wrong

Epoch 8/103. . . Train Loss 0.4079. . . Train Acc 0.8819
Epoch 8/103. . . Train Loss 0.4005. . . Train Acc 0.884
Epoch 8/103. . . Train Loss 0.3938. . . Train Acc 0.886
Epoch 8/103. . . Train Loss 0.3875. . . Train Acc 0.8878
Epoch 8/103. . . Train Loss 0.3818. . . Train Acc 0.8895

Caclulating loss & accuracy on validation set...
Epoch 8/103. . . Val Loss 3.187. . . Val Acc 0.6737

<Speed limit (30km/h)> is 7% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 6% of total wrong
<Speed limit (80km/h)> is 6% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<Road work> is 8% of total wrong

Epoch 9/103. . . Train Loss 0.376. . . Train Acc 0.8911
Epoch 9/103. . . Train Loss 0.37. . . Train Acc 0.8929
Epoch 9/103. . . Train Loss 0.3643. . . Train Acc 0.8945
Epoch 9/103. . . Train Loss 0.3589. . . Train Acc 0.8959
Epoch 9/103. . . Train Loss 0.3539. . . Train Acc 0.8974

Caclulating loss & accuracy on validation set...
Epoch 9/103. . . Val Loss 3.033. . . Val Acc 0.6569

<Speed limit (30km/h)> is 6% of total wrong
<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (60km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 6% of total wrong
<Speed limit (80km/h)> is 9% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Road work> is 8% of total wrong

Epoch 10/103. . . Train Loss 0.3491. . . Train Acc 0.8988
Epoch 10/103. . . Train Loss 0.3439. . . Train Acc 0.9002
Epoch 10/103. . . Train Loss 0.3393. . . Train Acc 0.9016
Epoch 10/103. . . Train Loss 0.3351. . . Train Acc 0.9028
Epoch 10/103. . . Train Loss 0.3308. . . Train Acc 0.9041
Epoch 10/103. . . Train Loss 0.3269. . . Train Acc 0.9052

Caclulating loss & accuracy on validation set...
Epoch 10/103. . . Val Loss 2.997. . . Val Acc 0.6372

<Speed limit (30km/h)> is 9% of total wrong
<Speed limit (50km/h)> is 10% of total wrong
<Speed limit (70km/h)> is 7% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Road work> is 8% of total wrong

Displaying validation samples...
Epoch 11/103. . . Train Loss 0.3229. . . Train Acc 0.9064
Epoch 11/103. . . Train Loss 0.3186. . . Train Acc 0.9076
Epoch 11/103. . . Train Loss 0.3147. . . Train Acc 0.9087
Epoch 11/103. . . Train Loss 0.3108. . . Train Acc 0.9098
Epoch 11/103. . . Train Loss 0.3074. . . Train Acc 0.9108

Caclulating loss & accuracy on validation set...
Epoch 11/103. . . Val Loss 2.707. . . Val Acc 0.6839

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 10% of total wrong
<Speed limit (70km/h)> is 6% of total wrong
<Speed limit (80km/h)> is 6% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<Road work> is 8% of total wrong

Epoch 12/103. . . Train Loss 0.304. . . Train Acc 0.9118
Epoch 12/103. . . Train Loss 0.3004. . . Train Acc 0.9129
Epoch 12/103. . . Train Loss 0.2973. . . Train Acc 0.9138
Epoch 12/103. . . Train Loss 0.2937. . . Train Acc 0.9148
Epoch 12/103. . . Train Loss 0.2908. . . Train Acc 0.9156
Epoch 12/103. . . Train Loss 0.2877. . . Train Acc 0.9165

Caclulating loss & accuracy on validation set...
Epoch 12/103. . . Val Loss 2.435. . . Val Acc 0.7659

<Speed limit (30km/h)> is 10% of total wrong
<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 7% of total wrong
<Speed limit (80km/h)> is 7% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<Road work> is 9% of total wrong

Epoch 13/103. . . Train Loss 0.2845. . . Train Acc 0.9174
Epoch 13/103. . . Train Loss 0.2814. . . Train Acc 0.9183
Epoch 13/103. . . Train Loss 0.2786. . . Train Acc 0.9191
Epoch 13/103. . . Train Loss 0.2758. . . Train Acc 0.9199
Epoch 13/103. . . Train Loss 0.2732. . . Train Acc 0.9207

Caclulating loss & accuracy on validation set...
Epoch 13/103. . . Val Loss 2.094. . . Val Acc 0.7339

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (60km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 5% of total wrong
<Speed limit (80km/h)> is 7% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Road work> is 9% of total wrong

Epoch 14/103. . . Train Loss 0.2704. . . Train Acc 0.9215
Epoch 14/103. . . Train Loss 0.2678. . . Train Acc 0.9223
Epoch 14/103. . . Train Loss 0.2653. . . Train Acc 0.923
Epoch 14/103. . . Train Loss 0.2628. . . Train Acc 0.9237
Epoch 14/103. . . Train Loss 0.2604. . . Train Acc 0.9244
Epoch 14/103. . . Train Loss 0.2581. . . Train Acc 0.925

Caclulating loss & accuracy on validation set...
Epoch 14/103. . . Val Loss 2.012. . . Val Acc 0.7188

<Speed limit (30km/h)> is 10% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 6% of total wrong
<Speed limit (80km/h)> is 9% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<Road work> is 7% of total wrong

Epoch 15/103. . . Train Loss 0.2558. . . Train Acc 0.9257
Epoch 15/103. . . Train Loss 0.2534. . . Train Acc 0.9264
Epoch 15/103. . . Train Loss 0.2513. . . Train Acc 0.927
Epoch 15/103. . . Train Loss 0.2492. . . Train Acc 0.9276
Epoch 15/103. . . Train Loss 0.2472. . . Train Acc 0.9282

Caclulating loss & accuracy on validation set...
Epoch 15/103. . . Val Loss 1.651. . . Val Acc 0.7683

<Speed limit (30km/h)> is 11% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 6% of total wrong
<Speed limit (80km/h)> is 7% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<Road work> is 8% of total wrong

Epoch 16/103. . . Train Loss 0.2452. . . Train Acc 0.9287
Epoch 16/103. . . Train Loss 0.243. . . Train Acc 0.9294
Epoch 16/103. . . Train Loss 0.241. . . Train Acc 0.9299
Epoch 16/103. . . Train Loss 0.239. . . Train Acc 0.9305
Epoch 16/103. . . Train Loss 0.237. . . Train Acc 0.9311
Epoch 16/103. . . Train Loss 0.2351. . . Train Acc 0.9316

Caclulating loss & accuracy on validation set...
Epoch 16/103. . . Val Loss 1.487. . . Val Acc 0.755

<Speed limit (30km/h)> is 9% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 7% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Road work> is 11% of total wrong

Epoch 17/103. . . Train Loss 0.2334. . . Train Acc 0.9321
Epoch 17/103. . . Train Loss 0.2316. . . Train Acc 0.9326
Epoch 17/103. . . Train Loss 0.23. . . Train Acc 0.9331
Epoch 17/103. . . Train Loss 0.2282. . . Train Acc 0.9336
Epoch 17/103. . . Train Loss 0.2265. . . Train Acc 0.9342

Caclulating loss & accuracy on validation set...
Epoch 17/103. . . Val Loss 1.262. . . Val Acc 0.805

<Speed limit (30km/h)> is 11% of total wrong
<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (100km/h> is 6% of total wrong
<Road work> is 10% of total wrong

Epoch 18/103. . . Train Loss 0.2249. . . Train Acc 0.9346
Epoch 18/103. . . Train Loss 0.2231. . . Train Acc 0.9351
Epoch 18/103. . . Train Loss 0.2215. . . Train Acc 0.9356
Epoch 18/103. . . Train Loss 0.2199. . . Train Acc 0.9361
Epoch 18/103. . . Train Loss 0.2183. . . Train Acc 0.9365

Caclulating loss & accuracy on validation set...
Epoch 18/103. . . Val Loss 1.067. . . Val Acc 0.8033

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (70km/h)> is 8% of total wrong
<Speed limit (100km/h> is 6% of total wrong
<Double curve> is 6% of total wrong
<Road work> is 6% of total wrong
<Roundabout mandatory> is 5% of total wrong

Epoch 19/103. . . Train Loss 0.2168. . . Train Acc 0.937
Epoch 19/103. . . Train Loss 0.2153. . . Train Acc 0.9374
Epoch 19/103. . . Train Loss 0.2138. . . Train Acc 0.9378
Epoch 19/103. . . Train Loss 0.2123. . . Train Acc 0.9382
Epoch 19/103. . . Train Loss 0.2109. . . Train Acc 0.9387
Epoch 19/103. . . Train Loss 0.2096. . . Train Acc 0.939

Caclulating loss & accuracy on validation set...
Epoch 19/103. . . Val Loss 1.02. . . Val Acc 0.8175

<Speed limit (30km/h)> is 9% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<Road work> is 11% of total wrong

Epoch 20/103. . . Train Loss 0.2081. . . Train Acc 0.9395
Epoch 20/103. . . Train Loss 0.2067. . . Train Acc 0.9398
Epoch 20/103. . . Train Loss 0.2054. . . Train Acc 0.9402
Epoch 20/103. . . Train Loss 0.204. . . Train Acc 0.9406
Epoch 20/103. . . Train Loss 0.2026. . . Train Acc 0.941

Caclulating loss & accuracy on validation set...
Epoch 20/103. . . Val Loss 1.051. . . Val Acc 0.8093

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<Road work> is 10% of total wrong

Displaying validation samples...
Epoch 21/103. . . Train Loss 0.2013. . . Train Acc 0.9414
Epoch 21/103. . . Train Loss 0.2001. . . Train Acc 0.9418
Epoch 21/103. . . Train Loss 0.1989. . . Train Acc 0.9421
Epoch 21/103. . . Train Loss 0.1977. . . Train Acc 0.9424
Epoch 21/103. . . Train Loss 0.1966. . . Train Acc 0.9428
Epoch 21/103. . . Train Loss 0.1954. . . Train Acc 0.9431

Caclulating loss & accuracy on validation set...
Epoch 21/103. . . Val Loss 0.9138. . . Val Acc 0.8105

<Speed limit (30km/h)> is 9% of total wrong
<Speed limit (70km/h)> is 8% of total wrong
<Speed limit (80km/h)> is 6% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Road work> is 9% of total wrong
<Roundabout mandatory> is 6% of total wrong

Epoch 22/103. . . Train Loss 0.194. . . Train Acc 0.9435
Epoch 22/103. . . Train Loss 0.1929. . . Train Acc 0.9438
Epoch 22/103. . . Train Loss 0.1917. . . Train Acc 0.9442
Epoch 22/103. . . Train Loss 0.1906. . . Train Acc 0.9445
Epoch 22/103. . . Train Loss 0.1895. . . Train Acc 0.9448

Caclulating loss & accuracy on validation set...
Epoch 22/103. . . Val Loss 0.7273. . . Val Acc 0.8188

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 8% of total wrong
<Speed limit (80km/h)> is 5% of total wrong
<Speed limit (120km/h> is 12% of total wrong
<Double curve> is 7% of total wrong
<Road work> is 8% of total wrong
<Wild animals crossin> is 5% of total wrong

Epoch 23/103. . . Train Loss 0.1884. . . Train Acc 0.9451
Epoch 23/103. . . Train Loss 0.1874. . . Train Acc 0.9454
Epoch 23/103. . . Train Loss 0.1864. . . Train Acc 0.9457
Epoch 23/103. . . Train Loss 0.1853. . . Train Acc 0.946
Epoch 23/103. . . Train Loss 0.1843. . . Train Acc 0.9463
Epoch 23/103. . . Train Loss 0.1833. . . Train Acc 0.9466

Caclulating loss & accuracy on validation set...
Epoch 23/103. . . Val Loss 0.7734. . . Val Acc 0.8202

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Yield> is 5% of total wrong
<Road work> is 11% of total wrong
<Wild animals crossin> is 6% of total wrong
<Roundabout mandatory> is 6% of total wrong

Epoch 24/103. . . Train Loss 0.1823. . . Train Acc 0.9469
Epoch 24/103. . . Train Loss 0.1814. . . Train Acc 0.9471
Epoch 24/103. . . Train Loss 0.1804. . . Train Acc 0.9474
Epoch 24/103. . . Train Loss 0.1796. . . Train Acc 0.9477
Epoch 24/103. . . Train Loss 0.1787. . . Train Acc 0.9479

Caclulating loss & accuracy on validation set...
Epoch 24/103. . . Val Loss 0.4652. . . Val Acc 0.8753

<Speed limit (50km/h)> is 9% of total wrong
<Speed limit (100km/h> is 6% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<Right-of-way at the > is 6% of total wrong
<Double curve> is 6% of total wrong
<Road work> is 9% of total wrong
<Pedestrians> is 6% of total wrong
<Roundabout mandatory> is 6% of total wrong
<End of no passing by> is 6% of total wrong

Epoch 25/103. . . Train Loss 0.1777. . . Train Acc 0.9482
Epoch 25/103. . . Train Loss 0.1767. . . Train Acc 0.9485
Epoch 25/103. . . Train Loss 0.1757. . . Train Acc 0.9488
Epoch 25/103. . . Train Loss 0.1748. . . Train Acc 0.9491
Epoch 25/103. . . Train Loss 0.174. . . Train Acc 0.9493
Epoch 25/103. . . Train Loss 0.1731. . . Train Acc 0.9495

Caclulating loss & accuracy on validation set...
Epoch 25/103. . . Val Loss 0.7532. . . Val Acc 0.8358

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (80km/h)> is 10% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<Road work> is 10% of total wrong

Epoch 26/103. . . Train Loss 0.1722. . . Train Acc 0.9498
Epoch 26/103. . . Train Loss 0.1714. . . Train Acc 0.95
Epoch 26/103. . . Train Loss 0.1705. . . Train Acc 0.9503
Epoch 26/103. . . Train Loss 0.1696. . . Train Acc 0.9505
Epoch 26/103. . . Train Loss 0.1687. . . Train Acc 0.9508

Caclulating loss & accuracy on validation set...
Epoch 26/103. . . Val Loss 0.92. . . Val Acc 0.8327

<Speed limit (30km/h)> is 11% of total wrong
<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<Road work> is 13% of total wrong

Epoch 27/103. . . Train Loss 0.1679. . . Train Acc 0.951
Epoch 27/103. . . Train Loss 0.167. . . Train Acc 0.9513
Epoch 27/103. . . Train Loss 0.1662. . . Train Acc 0.9515
Epoch 27/103. . . Train Loss 0.1655. . . Train Acc 0.9517
Epoch 27/103. . . Train Loss 0.1648. . . Train Acc 0.9519

Caclulating loss & accuracy on validation set...
Epoch 27/103. . . Val Loss 0.7282. . . Val Acc 0.8505

<Speed limit (30km/h)> is 9% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (80km/h)> is 6% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<Road work> is 13% of total wrong

Epoch 28/103. . . Train Loss 0.164. . . Train Acc 0.9522
Epoch 28/103. . . Train Loss 0.1631. . . Train Acc 0.9524
Epoch 28/103. . . Train Loss 0.1624. . . Train Acc 0.9526
Epoch 28/103. . . Train Loss 0.1617. . . Train Acc 0.9528
Epoch 28/103. . . Train Loss 0.1609. . . Train Acc 0.9531
Epoch 28/103. . . Train Loss 0.1602. . . Train Acc 0.9533

Caclulating loss & accuracy on validation set...
Epoch 28/103. . . Val Loss 0.7523. . . Val Acc 0.8225

<Speed limit (30km/h)> is 11% of total wrong
<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 8% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Double curve> is 7% of total wrong
<Road work> is 10% of total wrong

Epoch 29/103. . . Train Loss 0.1594. . . Train Acc 0.9535
Epoch 29/103. . . Train Loss 0.1588. . . Train Acc 0.9537
Epoch 29/103. . . Train Loss 0.1581. . . Train Acc 0.9539
Epoch 29/103. . . Train Loss 0.1575. . . Train Acc 0.9541
Epoch 29/103. . . Train Loss 0.1568. . . Train Acc 0.9542

Caclulating loss & accuracy on validation set...
Epoch 29/103. . . Val Loss 0.6211. . . Val Acc 0.8601

<Speed limit (30km/h)> is 13% of total wrong
<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 8% of total wrong
<Speed limit (100km/h> is 5% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<Vehicles over 3.5 me> is 5% of total wrong
<Road work> is 10% of total wrong
<Roundabout mandatory> is 5% of total wrong
<End of no passing by> is 5% of total wrong

Epoch 30/103. . . Train Loss 0.1561. . . Train Acc 0.9545
Epoch 30/103. . . Train Loss 0.1554. . . Train Acc 0.9546
Epoch 30/103. . . Train Loss 0.1547. . . Train Acc 0.9549
Epoch 30/103. . . Train Loss 0.154. . . Train Acc 0.9551
Epoch 30/103. . . Train Loss 0.1534. . . Train Acc 0.9552
Epoch 30/103. . . Train Loss 0.1528. . . Train Acc 0.9554

Caclulating loss & accuracy on validation set...
Epoch 30/103. . . Val Loss 0.5881. . . Val Acc 0.873

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (70km/h)> is 12% of total wrong
<Speed limit (100km/h> is 6% of total wrong
<Vehicles over 3.5 me> is 5% of total wrong
<Road work> is 8% of total wrong
<Pedestrians> is 5% of total wrong
<Children crossing> is 7% of total wrong
<Roundabout mandatory> is 5% of total wrong

Displaying validation samples...
Epoch 31/103. . . Train Loss 0.1522. . . Train Acc 0.9556
Epoch 31/103. . . Train Loss 0.1515. . . Train Acc 0.9558
Epoch 31/103. . . Train Loss 0.1508. . . Train Acc 0.956
Epoch 31/103. . . Train Loss 0.1502. . . Train Acc 0.9562
Epoch 31/103. . . Train Loss 0.1496. . . Train Acc 0.9563

Caclulating loss & accuracy on validation set...
Epoch 31/103. . . Val Loss 0.5534. . . Val Acc 0.8757

<Speed limit (30km/h)> is 5% of total wrong
<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (70km/h)> is 11% of total wrong
<Vehicles over 3.5 me> is 6% of total wrong
<Road work> is 10% of total wrong
<Children crossing> is 6% of total wrong
<Roundabout mandatory> is 5% of total wrong

Epoch 32/103. . . Train Loss 0.149. . . Train Acc 0.9565
Epoch 32/103. . . Train Loss 0.1485. . . Train Acc 0.9567
Epoch 32/103. . . Train Loss 0.1479. . . Train Acc 0.9568
Epoch 32/103. . . Train Loss 0.1472. . . Train Acc 0.957
Epoch 32/103. . . Train Loss 0.1467. . . Train Acc 0.9572
Epoch 32/103. . . Train Loss 0.1461. . . Train Acc 0.9574

Caclulating loss & accuracy on validation set...
Epoch 32/103. . . Val Loss 0.7336. . . Val Acc 0.8961

<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 13% of total wrong
<Speed limit (100km/h> is 7% of total wrong
<Speed limit (120km/h> is 14% of total wrong
<No entry> is 5% of total wrong
<Road work> is 9% of total wrong
<Roundabout mandatory> is 8% of total wrong
<End of no passing by> is 6% of total wrong

Epoch 33/103. . . Train Loss 0.1455. . . Train Acc 0.9575
Epoch 33/103. . . Train Loss 0.1449. . . Train Acc 0.9577
Epoch 33/103. . . Train Loss 0.1443. . . Train Acc 0.9579
Epoch 33/103. . . Train Loss 0.1437. . . Train Acc 0.958
Epoch 33/103. . . Train Loss 0.1432. . . Train Acc 0.9582

Caclulating loss & accuracy on validation set...
Epoch 33/103. . . Val Loss 0.8061. . . Val Acc 0.8671

<Speed limit (30km/h)> is 9% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 10% of total wrong
<Speed limit (100km/h> is 5% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<Road work> is 11% of total wrong
<Pedestrians> is 5% of total wrong
<Wild animals crossin> is 6% of total wrong
<Roundabout mandatory> is 5% of total wrong

Epoch 34/103. . . Train Loss 0.1428. . . Train Acc 0.9583
Epoch 34/103. . . Train Loss 0.1423. . . Train Acc 0.9585
Epoch 34/103. . . Train Loss 0.1417. . . Train Acc 0.9586
Epoch 34/103. . . Train Loss 0.1411. . . Train Acc 0.9588
Epoch 34/103. . . Train Loss 0.1406. . . Train Acc 0.959

Caclulating loss & accuracy on validation set...
Epoch 34/103. . . Val Loss 0.3613. . . Val Acc 0.9104
Model Saved!

<Speed limit (70km/h)> is 12% of total wrong
<Vehicles over 3.5 me> is 5% of total wrong
<Road work> is 11% of total wrong
<Pedestrians> is 8% of total wrong
<Ahead only> is 8% of total wrong

Epoch 35/103. . . Train Loss 0.1401. . . Train Acc 0.9591
Epoch 35/103. . . Train Loss 0.1395. . . Train Acc 0.9593
Epoch 35/103. . . Train Loss 0.139. . . Train Acc 0.9594
Epoch 35/103. . . Train Loss 0.1385. . . Train Acc 0.9596
Epoch 35/103. . . Train Loss 0.138. . . Train Acc 0.9597
Epoch 35/103. . . Train Loss 0.1375. . . Train Acc 0.9599

Caclulating loss & accuracy on validation set...
Epoch 35/103. . . Val Loss 0.8842. . . Val Acc 0.8714

<Speed limit (30km/h)> is 6% of total wrong
<Speed limit (50km/h)> is 9% of total wrong
<Speed limit (70km/h)> is 11% of total wrong
<Speed limit (100km/h> is 6% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 5% of total wrong
<Roundabout mandatory> is 5% of total wrong
<End of no passing by> is 5% of total wrong

Epoch 36/103. . . Train Loss 0.137. . . Train Acc 0.96
Epoch 36/103. . . Train Loss 0.1365. . . Train Acc 0.9601
Epoch 36/103. . . Train Loss 0.136. . . Train Acc 0.9603
Epoch 36/103. . . Train Loss 0.1355. . . Train Acc 0.9604
Epoch 36/103. . . Train Loss 0.1351. . . Train Acc 0.9605

Caclulating loss & accuracy on validation set...
Epoch 36/103. . . Val Loss 0.7303. . . Val Acc 0.8791

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 11% of total wrong
<Speed limit (120km/h> is 12% of total wrong
<Road work> is 9% of total wrong
<Pedestrians> is 6% of total wrong
<Wild animals crossin> is 7% of total wrong
<Roundabout mandatory> is 6% of total wrong

Epoch 37/103. . . Train Loss 0.1346. . . Train Acc 0.9607
Epoch 37/103. . . Train Loss 0.1341. . . Train Acc 0.9608
Epoch 37/103. . . Train Loss 0.1336. . . Train Acc 0.961
Epoch 37/103. . . Train Loss 0.1332. . . Train Acc 0.9611
Epoch 37/103. . . Train Loss 0.1328. . . Train Acc 0.9612
Epoch 37/103. . . Train Loss 0.1323. . . Train Acc 0.9613

Caclulating loss & accuracy on validation set...
Epoch 37/103. . . Val Loss 0.7374. . . Val Acc 0.8849

<Speed limit (30km/h)> is 5% of total wrong
<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (70km/h)> is 11% of total wrong
<Speed limit (100km/h> is 5% of total wrong
<Speed limit (120km/h> is 16% of total wrong
<Vehicles over 3.5 me> is 6% of total wrong
<Road work> is 9% of total wrong
<Wild animals crossin> is 6% of total wrong
<Roundabout mandatory> is 7% of total wrong

Epoch 38/103. . . Train Loss 0.1318. . . Train Acc 0.9615
Epoch 38/103. . . Train Loss 0.1315. . . Train Acc 0.9616
Epoch 38/103. . . Train Loss 0.131. . . Train Acc 0.9617
Epoch 38/103. . . Train Loss 0.1306. . . Train Acc 0.9618
Epoch 38/103. . . Train Loss 0.1301. . . Train Acc 0.962

Caclulating loss & accuracy on validation set...
Epoch 38/103. . . Val Loss 0.5501. . . Val Acc 0.9015

<Speed limit (30km/h)> is 18% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 10% of total wrong
<Road work> is 15% of total wrong
<Pedestrians> is 7% of total wrong
<Roundabout mandatory> is 7% of total wrong

Epoch 39/103. . . Train Loss 0.1297. . . Train Acc 0.9621
Epoch 39/103. . . Train Loss 0.1293. . . Train Acc 0.9622
Epoch 39/103. . . Train Loss 0.1289. . . Train Acc 0.9623
Epoch 39/103. . . Train Loss 0.1285. . . Train Acc 0.9624
Epoch 39/103. . . Train Loss 0.128. . . Train Acc 0.9626
Epoch 39/103. . . Train Loss 0.1276. . . Train Acc 0.9627

Caclulating loss & accuracy on validation set...
Epoch 39/103. . . Val Loss 0.2943. . . Val Acc 0.9407
Model Saved!

<Speed limit (30km/h)> is 10% of total wrong
<Speed limit (50km/h)> is 10% of total wrong
<Speed limit (100km/h> is 7% of total wrong
<Vehicles over 3.5 me> is 8% of total wrong
<No entry> is 7% of total wrong
<Road work> is 12% of total wrong
<Pedestrians> is 6% of total wrong
<Children crossing> is 6% of total wrong
<Roundabout mandatory> is 9% of total wrong

Epoch 40/103. . . Train Loss 0.1272. . . Train Acc 0.9628
Epoch 40/103. . . Train Loss 0.1268. . . Train Acc 0.9629
Epoch 40/103. . . Train Loss 0.1264. . . Train Acc 0.963
Epoch 40/103. . . Train Loss 0.126. . . Train Acc 0.9632
Epoch 40/103. . . Train Loss 0.1256. . . Train Acc 0.9633

Caclulating loss & accuracy on validation set...
Epoch 40/103. . . Val Loss 0.8954. . . Val Acc 0.8878

<Speed limit (50km/h)> is 11% of total wrong
<Speed limit (70km/h)> is 12% of total wrong
<Speed limit (100km/h> is 7% of total wrong
<Speed limit (120km/h> is 12% of total wrong
<Road work> is 12% of total wrong
<Roundabout mandatory> is 6% of total wrong

Displaying validation samples...
Epoch 41/103. . . Train Loss 0.1252. . . Train Acc 0.9634
Epoch 41/103. . . Train Loss 0.1248. . . Train Acc 0.9635
Epoch 41/103. . . Train Loss 0.1245. . . Train Acc 0.9636
Epoch 41/103. . . Train Loss 0.1241. . . Train Acc 0.9637
Epoch 41/103. . . Train Loss 0.1237. . . Train Acc 0.9638
Epoch 41/103. . . Train Loss 0.1233. . . Train Acc 0.964

Caclulating loss & accuracy on validation set...
Epoch 41/103. . . Val Loss 0.7357. . . Val Acc 0.9052

<Speed limit (30km/h)> is 10% of total wrong
<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 12% of total wrong
<Speed limit (100km/h> is 7% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<Vehicles over 3.5 me> is 6% of total wrong
<Road work> is 8% of total wrong
<Pedestrians> is 7% of total wrong

Epoch 42/103. . . Train Loss 0.1229. . . Train Acc 0.9641
Epoch 42/103. . . Train Loss 0.1225. . . Train Acc 0.9642
Epoch 42/103. . . Train Loss 0.1222. . . Train Acc 0.9643
Epoch 42/103. . . Train Loss 0.1218. . . Train Acc 0.9644
Epoch 42/103. . . Train Loss 0.1214. . . Train Acc 0.9645

Caclulating loss & accuracy on validation set...
Epoch 42/103. . . Val Loss 1.214. . . Val Acc 0.8768

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (100km/h> is 6% of total wrong
<Speed limit (120km/h> is 13% of total wrong
<Double curve> is 9% of total wrong
<Road work> is 12% of total wrong
<Pedestrians> is 6% of total wrong
<Roundabout mandatory> is 6% of total wrong

Epoch 43/103. . . Train Loss 0.1211. . . Train Acc 0.9646
Epoch 43/103. . . Train Loss 0.1207. . . Train Acc 0.9647
Epoch 43/103. . . Train Loss 0.1204. . . Train Acc 0.9648
Epoch 43/103. . . Train Loss 0.12. . . Train Acc 0.9649
Epoch 43/103. . . Train Loss 0.1196. . . Train Acc 0.965

Caclulating loss & accuracy on validation set...
Epoch 43/103. . . Val Loss 0.7876. . . Val Acc 0.9004

<Speed limit (50km/h)> is 10% of total wrong
<Speed limit (70km/h)> is 11% of total wrong
<Speed limit (120km/h> is 14% of total wrong
<Double curve> is 9% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 7% of total wrong

Epoch 44/103. . . Train Loss 0.1193. . . Train Acc 0.9651
Epoch 44/103. . . Train Loss 0.1189. . . Train Acc 0.9652
Epoch 44/103. . . Train Loss 0.1186. . . Train Acc 0.9653
Epoch 44/103. . . Train Loss 0.1183. . . Train Acc 0.9654
Epoch 44/103. . . Train Loss 0.118. . . Train Acc 0.9655
Epoch 44/103. . . Train Loss 0.1177. . . Train Acc 0.9656

Caclulating loss & accuracy on validation set...
Epoch 44/103. . . Val Loss 0.7463. . . Val Acc 0.9105

<Speed limit (20km/h)> is 5% of total wrong
<Speed limit (30km/h)> is 7% of total wrong
<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (70km/h)> is 12% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<Vehicles over 3.5 me> is 8% of total wrong
<Road work> is 6% of total wrong
<Pedestrians> is 5% of total wrong
<Roundabout mandatory> is 7% of total wrong

Epoch 45/103. . . Train Loss 0.1173. . . Train Acc 0.9657
Epoch 45/103. . . Train Loss 0.117. . . Train Acc 0.9658
Epoch 45/103. . . Train Loss 0.1167. . . Train Acc 0.9659
Epoch 45/103. . . Train Loss 0.1163. . . Train Acc 0.966
Epoch 45/103. . . Train Loss 0.116. . . Train Acc 0.9661

Caclulating loss & accuracy on validation set...
Epoch 45/103. . . Val Loss 0.4751. . . Val Acc 0.9466
Model Saved!

<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Vehicles over 3.5 me> is 12% of total wrong
<No entry> is 7% of total wrong
<Dangerous curve to t> is 6% of total wrong
<Road work> is 6% of total wrong
<Pedestrians> is 10% of total wrong
<Roundabout mandatory> is 9% of total wrong

Epoch 46/103. . . Train Loss 0.1157. . . Train Acc 0.9662
Epoch 46/103. . . Train Loss 0.1154. . . Train Acc 0.9662
Epoch 46/103. . . Train Loss 0.1151. . . Train Acc 0.9663
Epoch 46/103. . . Train Loss 0.1149. . . Train Acc 0.9664
Epoch 46/103. . . Train Loss 0.1145. . . Train Acc 0.9665
Epoch 46/103. . . Train Loss 0.1142. . . Train Acc 0.9666

Caclulating loss & accuracy on validation set...
Epoch 46/103. . . Val Loss 0.5067. . . Val Acc 0.9455

<Speed limit (50km/h)> is 12% of total wrong
<Speed limit (70km/h)> is 6% of total wrong
<Speed limit (120km/h> is 6% of total wrong
<Vehicles over 3.5 me> is 6% of total wrong
<No entry> is 8% of total wrong
<Road work> is 16% of total wrong
<Pedestrians> is 8% of total wrong
<Roundabout mandatory> is 6% of total wrong

Epoch 47/103. . . Train Loss 0.1139. . . Train Acc 0.9667
Epoch 47/103. . . Train Loss 0.1136. . . Train Acc 0.9668
Epoch 47/103. . . Train Loss 0.1133. . . Train Acc 0.9669
Epoch 47/103. . . Train Loss 0.113. . . Train Acc 0.967
Epoch 47/103. . . Train Loss 0.1127. . . Train Acc 0.9671

Caclulating loss & accuracy on validation set...
Epoch 47/103. . . Val Loss 0.5075. . . Val Acc 0.9499
Model Saved!

<Speed limit (50km/h)> is 9% of total wrong
<Speed limit (120km/h> is 12% of total wrong
<Vehicles over 3.5 me> is 11% of total wrong
<No entry> is 8% of total wrong
<Dangerous curve to t> is 5% of total wrong
<Road work> is 9% of total wrong
<Pedestrians> is 13% of total wrong

Epoch 48/103. . . Train Loss 0.1124. . . Train Acc 0.9671
Epoch 48/103. . . Train Loss 0.1121. . . Train Acc 0.9672
Epoch 48/103. . . Train Loss 0.1117. . . Train Acc 0.9673
Epoch 48/103. . . Train Loss 0.1115. . . Train Acc 0.9674
Epoch 48/103. . . Train Loss 0.1112. . . Train Acc 0.9675
Epoch 48/103. . . Train Loss 0.1109. . . Train Acc 0.9676

Caclulating loss & accuracy on validation set...
Epoch 48/103. . . Val Loss 0.8374. . . Val Acc 0.9141

<Speed limit (20km/h)> is 6% of total wrong
<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 6% of total wrong
<Speed limit (120km/h> is 7% of total wrong
<Double curve> is 7% of total wrong
<Road work> is 12% of total wrong
<Pedestrians> is 7% of total wrong
<Children crossing> is 8% of total wrong

Epoch 49/103. . . Train Loss 0.1106. . . Train Acc 0.9677
Epoch 49/103. . . Train Loss 0.1103. . . Train Acc 0.9677
Epoch 49/103. . . Train Loss 0.11. . . Train Acc 0.9678
Epoch 49/103. . . Train Loss 0.1097. . . Train Acc 0.9679
Epoch 49/103. . . Train Loss 0.1095. . . Train Acc 0.968

Caclulating loss & accuracy on validation set...
Epoch 49/103. . . Val Loss 1.039. . . Val Acc 0.9213

<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (70km/h)> is 10% of total wrong
<Speed limit (120km/h> is 5% of total wrong
<No passing> is 8% of total wrong
<Vehicles over 3.5 me> is 9% of total wrong
<No entry> is 5% of total wrong
<Slippery road> is 6% of total wrong
<Road work> is 12% of total wrong
<Pedestrians> is 9% of total wrong

Epoch 50/103. . . Train Loss 0.1092. . . Train Acc 0.9681
Epoch 50/103. . . Train Loss 0.1089. . . Train Acc 0.9681
Epoch 50/103. . . Train Loss 0.1086. . . Train Acc 0.9682
Epoch 50/103. . . Train Loss 0.1083. . . Train Acc 0.9683
Epoch 50/103. . . Train Loss 0.1081. . . Train Acc 0.9684
Epoch 50/103. . . Train Loss 0.1078. . . Train Acc 0.9685

Caclulating loss & accuracy on validation set...
Epoch 50/103. . . Val Loss 0.6372. . . Val Acc 0.9342

<Speed limit (70km/h)> is 8% of total wrong
<Speed limit (100km/h> is 6% of total wrong
<Vehicles over 3.5 me> is 9% of total wrong
<No entry> is 5% of total wrong
<Double curve> is 7% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 7% of total wrong
<Children crossing> is 10% of total wrong
<Roundabout mandatory> is 9% of total wrong
<End of no passing by> is 8% of total wrong

Displaying validation samples...
Epoch 51/103. . . Train Loss 0.1075. . . Train Acc 0.9685
Epoch 51/103. . . Train Loss 0.1073. . . Train Acc 0.9686
Epoch 51/103. . . Train Loss 0.107. . . Train Acc 0.9687
Epoch 51/103. . . Train Loss 0.1068. . . Train Acc 0.9688
Epoch 51/103. . . Train Loss 0.1065. . . Train Acc 0.9688

Caclulating loss & accuracy on validation set...
Epoch 51/103. . . Val Loss 0.6106. . . Val Acc 0.94

<Speed limit (20km/h)> is 10% of total wrong
<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<No entry> is 7% of total wrong
<Dangerous curve to t> is 5% of total wrong
<Double curve> is 5% of total wrong
<Road work> is 11% of total wrong
<Roundabout mandatory> is 11% of total wrong

Epoch 52/103. . . Train Loss 0.1063. . . Train Acc 0.9689
Epoch 52/103. . . Train Loss 0.106. . . Train Acc 0.969
Epoch 52/103. . . Train Loss 0.1058. . . Train Acc 0.9691
Epoch 52/103. . . Train Loss 0.1055. . . Train Acc 0.9691
Epoch 52/103. . . Train Loss 0.1053. . . Train Acc 0.9692

Caclulating loss & accuracy on validation set...
Epoch 52/103. . . Val Loss 0.6469. . . Val Acc 0.942

<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (70km/h)> is 9% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<Vehicles over 3.5 me> is 10% of total wrong
<No entry> is 5% of total wrong
<Dangerous curve to t> is 6% of total wrong
<Double curve> is 6% of total wrong
<Road work> is 13% of total wrong
<Roundabout mandatory> is 8% of total wrong

Epoch 53/103. . . Train Loss 0.105. . . Train Acc 0.9693
Epoch 53/103. . . Train Loss 0.1048. . . Train Acc 0.9693
Epoch 53/103. . . Train Loss 0.1045. . . Train Acc 0.9694
Epoch 53/103. . . Train Loss 0.1043. . . Train Acc 0.9695
Epoch 53/103. . . Train Loss 0.1041. . . Train Acc 0.9696
Epoch 53/103. . . Train Loss 0.1039. . . Train Acc 0.9696

Caclulating loss & accuracy on validation set...
Epoch 53/103. . . Val Loss 0.4702. . . Val Acc 0.9602
Model Saved!

<Speed limit (30km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 7% of total wrong
<Speed limit (120km/h> is 16% of total wrong
<No entry> is 11% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Road work> is 9% of total wrong
<Roundabout mandatory> is 10% of total wrong

Epoch 54/103. . . Train Loss 0.1036. . . Train Acc 0.9697
Epoch 54/103. . . Train Loss 0.1033. . . Train Acc 0.9698
Epoch 54/103. . . Train Loss 0.1031. . . Train Acc 0.9699
Epoch 54/103. . . Train Loss 0.1028. . . Train Acc 0.9699
Epoch 54/103. . . Train Loss 0.1026. . . Train Acc 0.97

Caclulating loss & accuracy on validation set...
Epoch 54/103. . . Val Loss 0.8797. . . Val Acc 0.9356

<Speed limit (30km/h)> is 9% of total wrong
<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (70km/h)> is 11% of total wrong
<Speed limit (120km/h> is 13% of total wrong
<Vehicles over 3.5 me> is 6% of total wrong
<No entry> is 7% of total wrong
<Dangerous curve to t> is 5% of total wrong
<Double curve> is 5% of total wrong
<Road work> is 11% of total wrong
<Roundabout mandatory> is 8% of total wrong

Epoch 55/103. . . Train Loss 0.1024. . . Train Acc 0.97
Epoch 55/103. . . Train Loss 0.1022. . . Train Acc 0.9701
Epoch 55/103. . . Train Loss 0.1019. . . Train Acc 0.9702
Epoch 55/103. . . Train Loss 0.1017. . . Train Acc 0.9702
Epoch 55/103. . . Train Loss 0.1015. . . Train Acc 0.9703
Epoch 55/103. . . Train Loss 0.1012. . . Train Acc 0.9704

Caclulating loss & accuracy on validation set...
Epoch 55/103. . . Val Loss 0.8296. . . Val Acc 0.944

<Speed limit (70km/h)> is 11% of total wrong
<Speed limit (120km/h> is 16% of total wrong
<Vehicles over 3.5 me> is 5% of total wrong
<No entry> is 7% of total wrong
<Road work> is 11% of total wrong
<Pedestrians> is 12% of total wrong
<Roundabout mandatory> is 7% of total wrong

Epoch 56/103. . . Train Loss 0.101. . . Train Acc 0.9705
Epoch 56/103. . . Train Loss 0.1008. . . Train Acc 0.9705
Epoch 56/103. . . Train Loss 0.1005. . . Train Acc 0.9706
Epoch 56/103. . . Train Loss 0.1003. . . Train Acc 0.9707
Epoch 56/103. . . Train Loss 0.1001. . . Train Acc 0.9707

Caclulating loss & accuracy on validation set...
Epoch 56/103. . . Val Loss 1.176. . . Val Acc 0.9341

<Speed limit (70km/h)> is 7% of total wrong
<Speed limit (120km/h> is 15% of total wrong
<Vehicles over 3.5 me> is 6% of total wrong
<No entry> is 7% of total wrong
<Double curve> is 8% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 10% of total wrong
<Roundabout mandatory> is 8% of total wrong

Epoch 57/103. . . Train Loss 0.09989. . . Train Acc 0.9708
Epoch 57/103. . . Train Loss 0.09967. . . Train Acc 0.9709
Epoch 57/103. . . Train Loss 0.09944. . . Train Acc 0.9709
Epoch 57/103. . . Train Loss 0.09922. . . Train Acc 0.971
Epoch 57/103. . . Train Loss 0.09902. . . Train Acc 0.971
Epoch 57/103. . . Train Loss 0.0988. . . Train Acc 0.9711

Caclulating loss & accuracy on validation set...
Epoch 57/103. . . Val Loss 0.848. . . Val Acc 0.9398

<Speed limit (50km/h)> is 9% of total wrong
<Speed limit (70km/h)> is 5% of total wrong
<Speed limit (120km/h> is 17% of total wrong
<Yield> is 5% of total wrong
<Vehicles over 3.5 me> is 11% of total wrong
<No entry> is 6% of total wrong
<Dangerous curve to t> is 6% of total wrong
<Road work> is 7% of total wrong
<Pedestrians> is 6% of total wrong
<Roundabout mandatory> is 6% of total wrong

Epoch 58/103. . . Train Loss 0.09858. . . Train Acc 0.9712
Epoch 58/103. . . Train Loss 0.09838. . . Train Acc 0.9712
Epoch 58/103. . . Train Loss 0.09818. . . Train Acc 0.9713
Epoch 58/103. . . Train Loss 0.09798. . . Train Acc 0.9713
Epoch 58/103. . . Train Loss 0.09779. . . Train Acc 0.9714

Caclulating loss & accuracy on validation set...
Epoch 58/103. . . Val Loss 0.6295. . . Val Acc 0.9616
Model Saved!

<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (120km/h> is 18% of total wrong
<No entry> is 13% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 7% of total wrong

Epoch 59/103. . . Train Loss 0.09757. . . Train Acc 0.9715
Epoch 59/103. . . Train Loss 0.09736. . . Train Acc 0.9715
Epoch 59/103. . . Train Loss 0.09715. . . Train Acc 0.9716
Epoch 59/103. . . Train Loss 0.09695. . . Train Acc 0.9716
Epoch 59/103. . . Train Loss 0.09672. . . Train Acc 0.9717

Caclulating loss & accuracy on validation set...
Epoch 59/103. . . Val Loss 1.098. . . Val Acc 0.9383

<Speed limit (120km/h> is 12% of total wrong
<Vehicles over 3.5 me> is 10% of total wrong
<No entry> is 7% of total wrong
<Dangerous curve to t> is 9% of total wrong
<Road work> is 9% of total wrong
<Pedestrians> is 10% of total wrong
<Bicycles crossing> is 7% of total wrong

Epoch 60/103. . . Train Loss 0.09655. . . Train Acc 0.9718
Epoch 60/103. . . Train Loss 0.09638. . . Train Acc 0.9718
Epoch 60/103. . . Train Loss 0.09617. . . Train Acc 0.9719
Epoch 60/103. . . Train Loss 0.09595. . . Train Acc 0.9719
Epoch 60/103. . . Train Loss 0.09577. . . Train Acc 0.972
Epoch 60/103. . . Train Loss 0.09559. . . Train Acc 0.972

Caclulating loss & accuracy on validation set...
Epoch 60/103. . . Val Loss 0.6863. . . Val Acc 0.9551

<Speed limit (50km/h)> is 12% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<No entry> is 11% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 12% of total wrong
<Bicycles crossing> is 5% of total wrong

Displaying validation samples...
Epoch 61/103. . . Train Loss 0.09538. . . Train Acc 0.9721
Epoch 61/103. . . Train Loss 0.09518. . . Train Acc 0.9722
Epoch 61/103. . . Train Loss 0.09498. . . Train Acc 0.9722
Epoch 61/103. . . Train Loss 0.0948. . . Train Acc 0.9723
Epoch 61/103. . . Train Loss 0.09461. . . Train Acc 0.9723

Caclulating loss & accuracy on validation set...
Epoch 61/103. . . Val Loss 1.053. . . Val Acc 0.9419

<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (120km/h> is 5% of total wrong
<Vehicles over 3.5 me> is 8% of total wrong
<No entry> is 8% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Double curve> is 11% of total wrong
<Slippery road> is 11% of total wrong
<Pedestrians> is 11% of total wrong

Epoch 62/103. . . Train Loss 0.0944. . . Train Acc 0.9724
Epoch 62/103. . . Train Loss 0.09419. . . Train Acc 0.9724
Epoch 62/103. . . Train Loss 0.094. . . Train Acc 0.9725
Epoch 62/103. . . Train Loss 0.09383. . . Train Acc 0.9725
Epoch 62/103. . . Train Loss 0.09363. . . Train Acc 0.9726
Epoch 62/103. . . Train Loss 0.09344. . . Train Acc 0.9727

Caclulating loss & accuracy on validation set...
Epoch 62/103. . . Val Loss 1.382. . . Val Acc 0.9351

<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (70km/h)> is 6% of total wrong
<Speed limit (100km/h> is 6% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<No entry> is 9% of total wrong
<Double curve> is 13% of total wrong
<Road work> is 7% of total wrong
<Pedestrians> is 11% of total wrong
<Roundabout mandatory> is 10% of total wrong

Epoch 63/103. . . Train Loss 0.09328. . . Train Acc 0.9727
Epoch 63/103. . . Train Loss 0.09309. . . Train Acc 0.9728
Epoch 63/103. . . Train Loss 0.09291. . . Train Acc 0.9728
Epoch 63/103. . . Train Loss 0.09272. . . Train Acc 0.9729
Epoch 63/103. . . Train Loss 0.09255. . . Train Acc 0.9729

Caclulating loss & accuracy on validation set...
Epoch 63/103. . . Val Loss 0.7381. . . Val Acc 0.9465

<Speed limit (120km/h> is 9% of total wrong
<Vehicles over 3.5 me> is 6% of total wrong
<No entry> is 8% of total wrong
<Dangerous curve to t> is 10% of total wrong
<Double curve> is 11% of total wrong
<Road work> is 12% of total wrong
<Pedestrians> is 9% of total wrong
<Roundabout mandatory> is 6% of total wrong

Epoch 64/103. . . Train Loss 0.09235. . . Train Acc 0.973
Epoch 64/103. . . Train Loss 0.0922. . . Train Acc 0.973
Epoch 64/103. . . Train Loss 0.09205. . . Train Acc 0.9731
Epoch 64/103. . . Train Loss 0.09187. . . Train Acc 0.9731
Epoch 64/103. . . Train Loss 0.09171. . . Train Acc 0.9732
Epoch 64/103. . . Train Loss 0.09152. . . Train Acc 0.9732

Caclulating loss & accuracy on validation set...
Epoch 64/103. . . Val Loss 0.8484. . . Val Acc 0.939

<Speed limit (30km/h)> is 6% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (60km/h)> is 8% of total wrong
<End of speed limit (> is 10% of total wrong
<Right-of-way at the > is 6% of total wrong
<No entry> is 6% of total wrong
<Dangerous curve to t> is 6% of total wrong
<Double curve> is 6% of total wrong
<Road work> is 7% of total wrong

Epoch 65/103. . . Train Loss 0.09139. . . Train Acc 0.9733
Epoch 65/103. . . Train Loss 0.09122. . . Train Acc 0.9733
Epoch 65/103. . . Train Loss 0.09104. . . Train Acc 0.9734
Epoch 65/103. . . Train Loss 0.09084. . . Train Acc 0.9734
Epoch 65/103. . . Train Loss 0.09067. . . Train Acc 0.9735

Caclulating loss & accuracy on validation set...
Epoch 65/103. . . Val Loss 0.7269. . . Val Acc 0.9606

<Speed limit (30km/h)> is 7% of total wrong
<Speed limit (120km/h> is 7% of total wrong
<No entry> is 13% of total wrong
<Dangerous curve to t> is 9% of total wrong
<Slippery road> is 6% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 13% of total wrong

Epoch 66/103. . . Train Loss 0.09053. . . Train Acc 0.9735
Epoch 66/103. . . Train Loss 0.09036. . . Train Acc 0.9736
Epoch 66/103. . . Train Loss 0.0902. . . Train Acc 0.9736
Epoch 66/103. . . Train Loss 0.09003. . . Train Acc 0.9737
Epoch 66/103. . . Train Loss 0.08985. . . Train Acc 0.9737
Epoch 66/103. . . Train Loss 0.08967. . . Train Acc 0.9738

Caclulating loss & accuracy on validation set...
Epoch 66/103. . . Val Loss 0.8005. . . Val Acc 0.9624
Model Saved!

<Speed limit (50km/h)> is 6% of total wrong
<End of speed limit (> is 7% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<No entry> is 14% of total wrong
<Dangerous curve to t> is 12% of total wrong
<Double curve> is 6% of total wrong
<Road work> is 13% of total wrong
<Pedestrians> is 10% of total wrong

Epoch 67/103. . . Train Loss 0.08949. . . Train Acc 0.9738
Epoch 67/103. . . Train Loss 0.08932. . . Train Acc 0.9739
Epoch 67/103. . . Train Loss 0.08913. . . Train Acc 0.9739
Epoch 67/103. . . Train Loss 0.089. . . Train Acc 0.974
Epoch 67/103. . . Train Loss 0.08883. . . Train Acc 0.974

Caclulating loss & accuracy on validation set...
Epoch 67/103. . . Val Loss 1.046. . . Val Acc 0.9589

<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (80km/h)> is 9% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<No entry> is 16% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Double curve> is 7% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 8% of total wrong

Epoch 68/103. . . Train Loss 0.08867. . . Train Acc 0.9741
Epoch 68/103. . . Train Loss 0.0885. . . Train Acc 0.9741
Epoch 68/103. . . Train Loss 0.08833. . . Train Acc 0.9742
Epoch 68/103. . . Train Loss 0.08817. . . Train Acc 0.9742
Epoch 68/103. . . Train Loss 0.08803. . . Train Acc 0.9742

Caclulating loss & accuracy on validation set...
Epoch 68/103. . . Val Loss 1.034. . . Val Acc 0.9656
Model Saved!

<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (70km/h)> is 10% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<No entry> is 16% of total wrong
<Dangerous curve to t> is 9% of total wrong
<Road work> is 7% of total wrong
<Pedestrians> is 13% of total wrong

Epoch 69/103. . . Train Loss 0.08787. . . Train Acc 0.9743
Epoch 69/103. . . Train Loss 0.08769. . . Train Acc 0.9743
Epoch 69/103. . . Train Loss 0.08752. . . Train Acc 0.9744
Epoch 69/103. . . Train Loss 0.08736. . . Train Acc 0.9744
Epoch 69/103. . . Train Loss 0.08718. . . Train Acc 0.9745
Epoch 69/103. . . Train Loss 0.08703. . . Train Acc 0.9745

Caclulating loss & accuracy on validation set...
Epoch 69/103. . . Val Loss 1.083. . . Val Acc 0.96

<Speed limit (50km/h)> is 9% of total wrong
<Speed limit (120km/h> is 5% of total wrong
<No entry> is 15% of total wrong
<Dangerous curve to t> is 9% of total wrong
<Road work> is 13% of total wrong
<Pedestrians> is 11% of total wrong
<Roundabout mandatory> is 11% of total wrong

Epoch 70/103. . . Train Loss 0.08689. . . Train Acc 0.9746
Epoch 70/103. . . Train Loss 0.08673. . . Train Acc 0.9746
Epoch 70/103. . . Train Loss 0.0866. . . Train Acc 0.9747
Epoch 70/103. . . Train Loss 0.08644. . . Train Acc 0.9747
Epoch 70/103. . . Train Loss 0.08631. . . Train Acc 0.9747

Caclulating loss & accuracy on validation set...
Epoch 70/103. . . Val Loss 1.021. . . Val Acc 0.9614

<Speed limit (120km/h> is 18% of total wrong
<No entry> is 12% of total wrong
<Dangerous curve to t> is 11% of total wrong
<Road work> is 14% of total wrong
<Pedestrians> is 16% of total wrong

Displaying validation samples...
Epoch 71/103. . . Train Loss 0.08619. . . Train Acc 0.9748
Epoch 71/103. . . Train Loss 0.08605. . . Train Acc 0.9748
Epoch 71/103. . . Train Loss 0.08592. . . Train Acc 0.9749
Epoch 71/103. . . Train Loss 0.08577. . . Train Acc 0.9749
Epoch 71/103. . . Train Loss 0.08561. . . Train Acc 0.975
Epoch 71/103. . . Train Loss 0.08547. . . Train Acc 0.975

Caclulating loss & accuracy on validation set...
Epoch 71/103. . . Val Loss 0.9464. . . Val Acc 0.9625

<Speed limit (30km/h)> is 5% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<No entry> is 10% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Double curve> is 7% of total wrong
<Road work> is 14% of total wrong
<Pedestrians> is 13% of total wrong

Epoch 72/103. . . Train Loss 0.08531. . . Train Acc 0.975
Epoch 72/103. . . Train Loss 0.08518. . . Train Acc 0.9751
Epoch 72/103. . . Train Loss 0.08503. . . Train Acc 0.9751
Epoch 72/103. . . Train Loss 0.08489. . . Train Acc 0.9752
Epoch 72/103. . . Train Loss 0.08474. . . Train Acc 0.9752

Caclulating loss & accuracy on validation set...
Epoch 72/103. . . Val Loss 1.34. . . Val Acc 0.9533

<Speed limit (120km/h> is 7% of total wrong
<Vehicles over 3.5 me> is 10% of total wrong
<No entry> is 12% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Double curve> is 6% of total wrong
<Road work> is 13% of total wrong
<Pedestrians> is 11% of total wrong
<Roundabout mandatory> is 7% of total wrong

Epoch 73/103. . . Train Loss 0.08458. . . Train Acc 0.9753
Epoch 73/103. . . Train Loss 0.08443. . . Train Acc 0.9753
Epoch 73/103. . . Train Loss 0.08429. . . Train Acc 0.9753
Epoch 73/103. . . Train Loss 0.08416. . . Train Acc 0.9754
Epoch 73/103. . . Train Loss 0.08403. . . Train Acc 0.9754
Epoch 73/103. . . Train Loss 0.08387. . . Train Acc 0.9755

Caclulating loss & accuracy on validation set...
Epoch 73/103. . . Val Loss 1.413. . . Val Acc 0.9419

<Speed limit (30km/h)> is 6% of total wrong
<Speed limit (80km/h)> is 9% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<No entry> is 10% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Double curve> is 15% of total wrong
<Road work> is 11% of total wrong
<Pedestrians> is 5% of total wrong
<Children crossing> is 7% of total wrong

Epoch 74/103. . . Train Loss 0.08374. . . Train Acc 0.9755
Epoch 74/103. . . Train Loss 0.08361. . . Train Acc 0.9755
Epoch 74/103. . . Train Loss 0.08346. . . Train Acc 0.9756
Epoch 74/103. . . Train Loss 0.08333. . . Train Acc 0.9756
Epoch 74/103. . . Train Loss 0.0832. . . Train Acc 0.9757

Caclulating loss & accuracy on validation set...
Epoch 74/103. . . Val Loss 1.725. . . Val Acc 0.9462

<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (120km/h> is 22% of total wrong
<Right-of-way at the > is 5% of total wrong
<Vehicles over 3.5 me> is 10% of total wrong
<No entry> is 10% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Road work> is 7% of total wrong
<Pedestrians> is 12% of total wrong

Epoch 75/103. . . Train Loss 0.08306. . . Train Acc 0.9757
Epoch 75/103. . . Train Loss 0.08292. . . Train Acc 0.9757
Epoch 75/103. . . Train Loss 0.08278. . . Train Acc 0.9758
Epoch 75/103. . . Train Loss 0.08266. . . Train Acc 0.9758
Epoch 75/103. . . Train Loss 0.08253. . . Train Acc 0.9759
Epoch 75/103. . . Train Loss 0.08238. . . Train Acc 0.9759

Caclulating loss & accuracy on validation set...
Epoch 75/103. . . Val Loss 1.518. . . Val Acc 0.9526

<Speed limit (120km/h> is 8% of total wrong
<Vehicles over 3.5 me> is 13% of total wrong
<No entry> is 12% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Slippery road> is 6% of total wrong
<Road work> is 7% of total wrong
<Traffic signals> is 6% of total wrong
<Pedestrians> is 12% of total wrong
<Roundabout mandatory> is 6% of total wrong

Epoch 76/103. . . Train Loss 0.08224. . . Train Acc 0.9759
Epoch 76/103. . . Train Loss 0.08212. . . Train Acc 0.976
Epoch 76/103. . . Train Loss 0.082. . . Train Acc 0.976
Epoch 76/103. . . Train Loss 0.08187. . . Train Acc 0.976
Epoch 76/103. . . Train Loss 0.08176. . . Train Acc 0.9761

Caclulating loss & accuracy on validation set...
Epoch 76/103. . . Val Loss 1.308. . . Val Acc 0.9526

<Speed limit (30km/h)> is 6% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<Right-of-way at the > is 7% of total wrong
<No entry> is 11% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 7% of total wrong
<Roundabout mandatory> is 9% of total wrong
<End of no passing> is 9% of total wrong

Epoch 77/103. . . Train Loss 0.08162. . . Train Acc 0.9761
Epoch 77/103. . . Train Loss 0.08147. . . Train Acc 0.9762
Epoch 77/103. . . Train Loss 0.08135. . . Train Acc 0.9762
Epoch 77/103. . . Train Loss 0.08124. . . Train Acc 0.9762
Epoch 77/103. . . Train Loss 0.08111. . . Train Acc 0.9763

Caclulating loss & accuracy on validation set...
Epoch 77/103. . . Val Loss 1.364. . . Val Acc 0.9544

<Speed limit (30km/h)> is 5% of total wrong
<Speed limit (120km/h> is 6% of total wrong
<No entry> is 11% of total wrong
<Dangerous curve to t> is 12% of total wrong
<Road work> is 10% of total wrong
<Pedestrians> is 10% of total wrong
<Children crossing> is 8% of total wrong
<Roundabout mandatory> is 12% of total wrong

Epoch 78/103. . . Train Loss 0.081. . . Train Acc 0.9763
Epoch 78/103. . . Train Loss 0.08089. . . Train Acc 0.9763
Epoch 78/103. . . Train Loss 0.08077. . . Train Acc 0.9764
Epoch 78/103. . . Train Loss 0.08064. . . Train Acc 0.9764
Epoch 78/103. . . Train Loss 0.08051. . . Train Acc 0.9764
Epoch 78/103. . . Train Loss 0.08036. . . Train Acc 0.9765

Caclulating loss & accuracy on validation set...
Epoch 78/103. . . Val Loss 1.073. . . Val Acc 0.964

<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (120km/h> is 12% of total wrong
<No entry> is 10% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Road work> is 20% of total wrong
<Pedestrians> is 13% of total wrong
<Roundabout mandatory> is 7% of total wrong

Epoch 79/103. . . Train Loss 0.08023. . . Train Acc 0.9765
Epoch 79/103. . . Train Loss 0.08009. . . Train Acc 0.9766
Epoch 79/103. . . Train Loss 0.07996. . . Train Acc 0.9766
Epoch 79/103. . . Train Loss 0.07983. . . Train Acc 0.9766
Epoch 79/103. . . Train Loss 0.07969. . . Train Acc 0.9767

Caclulating loss & accuracy on validation set...
Epoch 79/103. . . Val Loss 1.17. . . Val Acc 0.9649

<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<No entry> is 12% of total wrong
<Dangerous curve to t> is 10% of total wrong
<Road work> is 16% of total wrong
<Pedestrians> is 10% of total wrong
<Beware of ice/snow> is 7% of total wrong

Epoch 80/103. . . Train Loss 0.07956. . . Train Acc 0.9767
Epoch 80/103. . . Train Loss 0.07947. . . Train Acc 0.9767
Epoch 80/103. . . Train Loss 0.07935. . . Train Acc 0.9768
Epoch 80/103. . . Train Loss 0.07923. . . Train Acc 0.9768
Epoch 80/103. . . Train Loss 0.07911. . . Train Acc 0.9768
Epoch 80/103. . . Train Loss 0.07899. . . Train Acc 0.9769

Caclulating loss & accuracy on validation set...
Epoch 80/103. . . Val Loss 1.93. . . Val Acc 0.9497

<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<Right-of-way at the > is 7% of total wrong
<Vehicles over 3.5 me> is 7% of total wrong
<No entry> is 10% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Double curve> is 9% of total wrong
<Slippery road> is 11% of total wrong
<Pedestrians> is 7% of total wrong
<Roundabout mandatory> is 8% of total wrong

Displaying validation samples...
Epoch 81/103. . . Train Loss 0.07886. . . Train Acc 0.9769
Epoch 81/103. . . Train Loss 0.07875. . . Train Acc 0.977
Epoch 81/103. . . Train Loss 0.07864. . . Train Acc 0.977
Epoch 81/103. . . Train Loss 0.07853. . . Train Acc 0.977
Epoch 81/103. . . Train Loss 0.07841. . . Train Acc 0.9771

Caclulating loss & accuracy on validation set...
Epoch 81/103. . . Val Loss 1.383. . . Val Acc 0.9528

<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (70km/h)> is 5% of total wrong
<Speed limit (80km/h)> is 7% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<No entry> is 13% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Road work> is 13% of total wrong
<Roundabout mandatory> is 8% of total wrong

Epoch 82/103. . . Train Loss 0.07829. . . Train Acc 0.9771
Epoch 82/103. . . Train Loss 0.07818. . . Train Acc 0.9771
Epoch 82/103. . . Train Loss 0.07806. . . Train Acc 0.9772
Epoch 82/103. . . Train Loss 0.07794. . . Train Acc 0.9772
Epoch 82/103. . . Train Loss 0.07785. . . Train Acc 0.9772
Epoch 82/103. . . Train Loss 0.07773. . . Train Acc 0.9773

Caclulating loss & accuracy on validation set...
Epoch 82/103. . . Val Loss 2.328. . . Val Acc 0.9483

<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Vehicles over 3.5 me> is 8% of total wrong
<No entry> is 13% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Double curve> is 11% of total wrong
<Road work> is 13% of total wrong
<Pedestrians> is 8% of total wrong

Epoch 83/103. . . Train Loss 0.07763. . . Train Acc 0.9773
Epoch 83/103. . . Train Loss 0.07751. . . Train Acc 0.9773
Epoch 83/103. . . Train Loss 0.07742. . . Train Acc 0.9773
Epoch 83/103. . . Train Loss 0.07731. . . Train Acc 0.9774
Epoch 83/103. . . Train Loss 0.0772. . . Train Acc 0.9774

Caclulating loss & accuracy on validation set...
Epoch 83/103. . . Val Loss 2.051. . . Val Acc 0.9376

<Speed limit (80km/h)> is 11% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<Vehicles over 3.5 me> is 11% of total wrong
<Dangerous curve to t> is 6% of total wrong
<Double curve> is 7% of total wrong
<Slippery road> is 8% of total wrong
<Road work> is 6% of total wrong
<Pedestrians> is 7% of total wrong
<Children crossing> is 6% of total wrong

Epoch 84/103. . . Train Loss 0.07709. . . Train Acc 0.9774
Epoch 84/103. . . Train Loss 0.07697. . . Train Acc 0.9775
Epoch 84/103. . . Train Loss 0.07686. . . Train Acc 0.9775
Epoch 84/103. . . Train Loss 0.07674. . . Train Acc 0.9776
Epoch 84/103. . . Train Loss 0.07662. . . Train Acc 0.9776

Caclulating loss & accuracy on validation set...
Epoch 84/103. . . Val Loss 1.906. . . Val Acc 0.9581

<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (120km/h> is 13% of total wrong
<Yield> is 14% of total wrong
<No entry> is 11% of total wrong
<Road work> is 10% of total wrong

Epoch 85/103. . . Train Loss 0.07652. . . Train Acc 0.9776
Epoch 85/103. . . Train Loss 0.07641. . . Train Acc 0.9776
Epoch 85/103. . . Train Loss 0.07631. . . Train Acc 0.9777
Epoch 85/103. . . Train Loss 0.0762. . . Train Acc 0.9777
Epoch 85/103. . . Train Loss 0.07608. . . Train Acc 0.9777
Epoch 85/103. . . Train Loss 0.07598. . . Train Acc 0.9778

Caclulating loss & accuracy on validation set...
Epoch 85/103. . . Val Loss 2.032. . . Val Acc 0.9522

<Speed limit (120km/h> is 13% of total wrong
<Yield> is 7% of total wrong
<No entry> is 9% of total wrong
<Dangerous curve to t> is 9% of total wrong
<Double curve> is 9% of total wrong
<Road work> is 9% of total wrong
<Pedestrians> is 6% of total wrong
<Bicycles crossing> is 9% of total wrong

Epoch 86/103. . . Train Loss 0.07588. . . Train Acc 0.9778
Epoch 86/103. . . Train Loss 0.07578. . . Train Acc 0.9778
Epoch 86/103. . . Train Loss 0.07568. . . Train Acc 0.9779
Epoch 86/103. . . Train Loss 0.07559. . . Train Acc 0.9779
Epoch 86/103. . . Train Loss 0.07549. . . Train Acc 0.9779

Caclulating loss & accuracy on validation set...
Epoch 86/103. . . Val Loss 4.489. . . Val Acc 0.9526

<Speed limit (50km/h)> is 7% of total wrong
<Vehicles over 3.5 me> is 14% of total wrong
<No entry> is 11% of total wrong
<Dangerous curve to t> is 6% of total wrong
<Slippery road> is 11% of total wrong
<Road work> is 6% of total wrong
<Pedestrians> is 8% of total wrong

Epoch 87/103. . . Train Loss 0.07537. . . Train Acc 0.978
Epoch 87/103. . . Train Loss 0.07526. . . Train Acc 0.978
Epoch 87/103. . . Train Loss 0.07516. . . Train Acc 0.978
Epoch 87/103. . . Train Loss 0.07506. . . Train Acc 0.978
Epoch 87/103. . . Train Loss 0.07496. . . Train Acc 0.9781
Epoch 87/103. . . Train Loss 0.07485. . . Train Acc 0.9781

Caclulating loss & accuracy on validation set...
Epoch 87/103. . . Val Loss 2.223. . . Val Acc 0.9592

<Speed limit (50km/h)> is 5% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<Vehicles over 3.5 me> is 14% of total wrong
<No entry> is 10% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Road work> is 7% of total wrong

Epoch 88/103. . . Train Loss 0.07475. . . Train Acc 0.9781
Epoch 88/103. . . Train Loss 0.07463. . . Train Acc 0.9782
Epoch 88/103. . . Train Loss 0.07453. . . Train Acc 0.9782
Epoch 88/103. . . Train Loss 0.07443. . . Train Acc 0.9782
Epoch 88/103. . . Train Loss 0.07433. . . Train Acc 0.9783

Caclulating loss & accuracy on validation set...
Epoch 88/103. . . Val Loss 1.825. . . Val Acc 0.9521

<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (60km/h)> is 5% of total wrong
<End of speed limit (> is 6% of total wrong
<Speed limit (120km/h> is 10% of total wrong
<Vehicles over 3.5 me> is 5% of total wrong
<No entry> is 9% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Double curve> is 9% of total wrong
<Road work> is 10% of total wrong
<Bicycles crossing> is 6% of total wrong

Epoch 89/103. . . Train Loss 0.07424. . . Train Acc 0.9783
Epoch 89/103. . . Train Loss 0.07414. . . Train Acc 0.9783
Epoch 89/103. . . Train Loss 0.07403. . . Train Acc 0.9783
Epoch 89/103. . . Train Loss 0.07394. . . Train Acc 0.9784
Epoch 89/103. . . Train Loss 0.07385. . . Train Acc 0.9784
Epoch 89/103. . . Train Loss 0.07375. . . Train Acc 0.9784

Caclulating loss & accuracy on validation set...
Epoch 89/103. . . Val Loss 2.058. . . Val Acc 0.9709
Model Saved!

<Speed limit (50km/h)> is 9% of total wrong
<Speed limit (120km/h> is 12% of total wrong
<No entry> is 16% of total wrong
<Dangerous curve to t> is 13% of total wrong
<Double curve> is 8% of total wrong
<Road work> is 7% of total wrong
<Pedestrians> is 5% of total wrong
<Roundabout mandatory> is 13% of total wrong

Epoch 90/103. . . Train Loss 0.07366. . . Train Acc 0.9785
Epoch 90/103. . . Train Loss 0.07356. . . Train Acc 0.9785
Epoch 90/103. . . Train Loss 0.07344. . . Train Acc 0.9785
Epoch 90/103. . . Train Loss 0.07333. . . Train Acc 0.9785
Epoch 90/103. . . Train Loss 0.07322. . . Train Acc 0.9786

Caclulating loss & accuracy on validation set...
Epoch 90/103. . . Val Loss 2.604. . . Val Acc 0.9607

<Speed limit (120km/h> is 11% of total wrong
<Vehicles over 3.5 me> is 8% of total wrong
<No entry> is 12% of total wrong
<Dangerous curve to t> is 6% of total wrong
<Road work> is 16% of total wrong
<Pedestrians> is 8% of total wrong
<Bicycles crossing> is 7% of total wrong

Displaying validation samples...
Epoch 91/103. . . Train Loss 0.07313. . . Train Acc 0.9786
Epoch 91/103. . . Train Loss 0.07304. . . Train Acc 0.9786
Epoch 91/103. . . Train Loss 0.07295. . . Train Acc 0.9787
Epoch 91/103. . . Train Loss 0.07285. . . Train Acc 0.9787
Epoch 91/103. . . Train Loss 0.07276. . . Train Acc 0.9787
Epoch 91/103. . . Train Loss 0.07266. . . Train Acc 0.9787

Caclulating loss & accuracy on validation set...
Epoch 91/103. . . Val Loss 3.265. . . Val Acc 0.9521

<Speed limit (120km/h> is 12% of total wrong
<Vehicles over 3.5 me> is 14% of total wrong
<No entry> is 9% of total wrong
<Dangerous curve to t> is 5% of total wrong
<Road work> is 13% of total wrong
<Bicycles crossing> is 12% of total wrong
<Roundabout mandatory> is 9% of total wrong

Epoch 92/103. . . Train Loss 0.07256. . . Train Acc 0.9788
Epoch 92/103. . . Train Loss 0.07246. . . Train Acc 0.9788
Epoch 92/103. . . Train Loss 0.07236. . . Train Acc 0.9788
Epoch 92/103. . . Train Loss 0.07226. . . Train Acc 0.9789
Epoch 92/103. . . Train Loss 0.07218. . . Train Acc 0.9789

Caclulating loss & accuracy on validation set...
Epoch 92/103. . . Val Loss 2.412. . . Val Acc 0.9648

<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<Right-of-way at the > is 5% of total wrong
<Vehicles over 3.5 me> is 16% of total wrong
<No entry> is 13% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Road work> is 8% of total wrong
<Roundabout mandatory> is 7% of total wrong

Epoch 93/103. . . Train Loss 0.07209. . . Train Acc 0.9789
Epoch 93/103. . . Train Loss 0.07198. . . Train Acc 0.9789
Epoch 93/103. . . Train Loss 0.07189. . . Train Acc 0.979
Epoch 93/103. . . Train Loss 0.0718. . . Train Acc 0.979
Epoch 93/103. . . Train Loss 0.07172. . . Train Acc 0.979

Caclulating loss & accuracy on validation set...
Epoch 93/103. . . Val Loss 2.443. . . Val Acc 0.9521

<Speed limit (50km/h)> is 6% of total wrong
<End of speed limit (> is 6% of total wrong
<Speed limit (120km/h> is 9% of total wrong
<Right-of-way at the > is 6% of total wrong
<No entry> is 10% of total wrong
<Dangerous curve to t> is 14% of total wrong
<Double curve> is 8% of total wrong
<Bumpy road> is 5% of total wrong
<Bicycles crossing> is 6% of total wrong

Epoch 94/103. . . Train Loss 0.07164. . . Train Acc 0.979
Epoch 94/103. . . Train Loss 0.07154. . . Train Acc 0.9791
Epoch 94/103. . . Train Loss 0.07145. . . Train Acc 0.9791
Epoch 94/103. . . Train Loss 0.07136. . . Train Acc 0.9791
Epoch 94/103. . . Train Loss 0.07128. . . Train Acc 0.9791
Epoch 94/103. . . Train Loss 0.0712. . . Train Acc 0.9792

Caclulating loss & accuracy on validation set...
Epoch 94/103. . . Val Loss 4.175. . . Val Acc 0.9315

<Speed limit (80km/h)> is 16% of total wrong
<End of speed limit (> is 7% of total wrong
<Right-of-way at the > is 5% of total wrong
<Vehicles over 3.5 me> is 10% of total wrong
<No entry> is 7% of total wrong
<Dangerous curve to t> is 10% of total wrong
<Road work> is 7% of total wrong
<Children crossing> is 8% of total wrong

Epoch 95/103. . . Train Loss 0.07111. . . Train Acc 0.9792
Epoch 95/103. . . Train Loss 0.071. . . Train Acc 0.9792
Epoch 95/103. . . Train Loss 0.0709. . . Train Acc 0.9792
Epoch 95/103. . . Train Loss 0.07082. . . Train Acc 0.9793
Epoch 95/103. . . Train Loss 0.07075. . . Train Acc 0.9793

Caclulating loss & accuracy on validation set...
Epoch 95/103. . . Val Loss 4.955. . . Val Acc 0.9343

<Speed limit (80km/h)> is 18% of total wrong
<End of speed limit (> is 11% of total wrong
<Speed limit (120km/h> is 6% of total wrong
<Vehicles over 3.5 me> is 10% of total wrong
<No entry> is 9% of total wrong
<Dangerous curve to t> is 9% of total wrong
<Double curve> is 7% of total wrong

Epoch 96/103. . . Train Loss 0.07066. . . Train Acc 0.9793
Epoch 96/103. . . Train Loss 0.07056. . . Train Acc 0.9794
Epoch 96/103. . . Train Loss 0.07048. . . Train Acc 0.9794
Epoch 96/103. . . Train Loss 0.07041. . . Train Acc 0.9794
Epoch 96/103. . . Train Loss 0.07031. . . Train Acc 0.9794
Epoch 96/103. . . Train Loss 0.07022. . . Train Acc 0.9794

Caclulating loss & accuracy on validation set...
Epoch 96/103. . . Val Loss 3.75. . . Val Acc 0.9612

<Speed limit (30km/h)> is 11% of total wrong
<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (60km/h)> is 8% of total wrong
<Speed limit (70km/h)> is 8% of total wrong
<Vehicles over 3.5 me> is 9% of total wrong
<No entry> is 13% of total wrong
<Dangerous curve to t> is 15% of total wrong

Epoch 97/103. . . Train Loss 0.07014. . . Train Acc 0.9795
Epoch 97/103. . . Train Loss 0.07006. . . Train Acc 0.9795
Epoch 97/103. . . Train Loss 0.06997. . . Train Acc 0.9795
Epoch 97/103. . . Train Loss 0.06988. . . Train Acc 0.9795
Epoch 97/103. . . Train Loss 0.0698. . . Train Acc 0.9796

Caclulating loss & accuracy on validation set...
Epoch 97/103. . . Val Loss 2.297. . . Val Acc 0.9672

<Speed limit (30km/h)> is 8% of total wrong
<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (80km/h)> is 11% of total wrong
<Speed limit (120km/h> is 6% of total wrong
<No entry> is 15% of total wrong
<Dangerous curve to t> is 15% of total wrong
<Road work> is 6% of total wrong
<Roundabout mandatory> is 6% of total wrong

Epoch 98/103. . . Train Loss 0.06971. . . Train Acc 0.9796
Epoch 98/103. . . Train Loss 0.06965. . . Train Acc 0.9796
Epoch 98/103. . . Train Loss 0.06958. . . Train Acc 0.9796
Epoch 98/103. . . Train Loss 0.06948. . . Train Acc 0.9797
Epoch 98/103. . . Train Loss 0.06939. . . Train Acc 0.9797
Epoch 98/103. . . Train Loss 0.0693. . . Train Acc 0.9797

Caclulating loss & accuracy on validation set...
Epoch 98/103. . . Val Loss 1.85. . . Val Acc 0.9672

<Speed limit (50km/h)> is 11% of total wrong
<Speed limit (80km/h)> is 6% of total wrong
<Speed limit (120km/h> is 12% of total wrong
<No entry> is 12% of total wrong
<Dangerous curve to t> is 14% of total wrong
<Road work> is 10% of total wrong

Epoch 99/103. . . Train Loss 0.06921. . . Train Acc 0.9797
Epoch 99/103. . . Train Loss 0.06912. . . Train Acc 0.9798
Epoch 99/103. . . Train Loss 0.06903. . . Train Acc 0.9798
Epoch 99/103. . . Train Loss 0.06894. . . Train Acc 0.9798
Epoch 99/103. . . Train Loss 0.06885. . . Train Acc 0.9799

Caclulating loss & accuracy on validation set...
Epoch 99/103. . . Val Loss 2.743. . . Val Acc 0.9669

<Speed limit (50km/h)> is 8% of total wrong
<Speed limit (120km/h> is 11% of total wrong
<No entry> is 13% of total wrong
<Dangerous curve to t> is 12% of total wrong
<Double curve> is 11% of total wrong
<Pedestrians> is 5% of total wrong
<Roundabout mandatory> is 5% of total wrong

Epoch 100/103. . . Train Loss 0.06877. . . Train Acc 0.9799
Epoch 100/103. . . Train Loss 0.06867. . . Train Acc 0.9799
Epoch 100/103. . . Train Loss 0.06858. . . Train Acc 0.9799
Epoch 100/103. . . Train Loss 0.0685. . . Train Acc 0.98
Epoch 100/103. . . Train Loss 0.06842. . . Train Acc 0.98
Epoch 100/103. . . Train Loss 0.06833. . . Train Acc 0.98

Caclulating loss & accuracy on validation set...
Epoch 100/103. . . Val Loss 3.062. . . Val Acc 0.9559

<Speed limit (50km/h)> is 7% of total wrong
<Speed limit (120km/h> is 17% of total wrong
<No entry> is 9% of total wrong
<Dangerous curve to t> is 7% of total wrong
<Slippery road> is 7% of total wrong
<Road work> is 16% of total wrong
<Pedestrians> is 7% of total wrong
<Children crossing> is 7% of total wrong

Displaying validation samples...
Epoch 101/103. . . Train Loss 0.06824. . . Train Acc 0.98
Epoch 101/103. . . Train Loss 0.06817. . . Train Acc 0.9801
Epoch 101/103. . . Train Loss 0.06809. . . Train Acc 0.9801
Epoch 101/103. . . Train Loss 0.06801. . . Train Acc 0.9801
Epoch 101/103. . . Train Loss 0.06796. . . Train Acc 0.9801

Caclulating loss & accuracy on validation set...
Epoch 101/103. . . Val Loss 2.706. . . Val Acc 0.9524

<Speed limit (50km/h)> is 6% of total wrong
<Speed limit (80km/h)> is 8% of total wrong
<Speed limit (120km/h> is 12% of total wrong
<Vehicles over 3.5 me> is 9% of total wrong
<No entry> is 9% of total wrong
<Dangerous curve to t> is 10% of total wrong
<Slippery road> is 8% of total wrong
<Children crossing> is 5% of total wrong

Epoch 102/103. . . Train Loss 0.06788. . . Train Acc 0.9801
Epoch 102/103. . . Train Loss 0.06779. . . Train Acc 0.9802
Epoch 102/103. . . Train Loss 0.06772. . . Train Acc 0.9802
Epoch 102/103. . . Train Loss 0.06764. . . Train Acc 0.9802
Epoch 102/103. . . Train Loss 0.06755. . . Train Acc 0.9802

Caclulating loss & accuracy on validation set...
Epoch 102/103. . . Val Loss 2.607. . . Val Acc 0.9524

<End of speed limit (> is 11% of total wrong
<Speed limit (120km/h> is 8% of total wrong
<Yield> is 6% of total wrong
<Vehicles over 3.5 me> is 6% of total wrong
<No entry> is 9% of total wrong
<Dangerous curve to t> is 10% of total wrong
<Children crossing> is 12% of total wrong

Epoch 103/103. . . Train Loss 0.06747. . . Train Acc 0.9803
Epoch 103/103. . . Train Loss 0.06738. . . Train Acc 0.9803
Epoch 103/103. . . Train Loss 0.06731. . . Train Acc 0.9803
Epoch 103/103. . . Train Loss 0.06723. . . Train Acc 0.9803
Epoch 103/103. . . Train Loss 0.06715. . . Train Acc 0.9803
Epoch 103/103. . . Train Loss 0.06706. . . Train Acc 0.9804

Caclulating loss & accuracy on validation set...
Epoch 103/103. . . Val Loss 4.337. . . Val Acc 0.948

<Speed limit (120km/h> is 15% of total wrong
<Right-of-way at the > is 5% of total wrong
<Vehicles over 3.5 me> is 10% of total wrong
<No entry> is 8% of total wrong
<Dangerous curve to t> is 8% of total wrong
<Double curve> is 14% of total wrong
<Pedestrians> is 6% of total wrong

Model finished training :)

Load best checkpoint and double-check accuracy on val set

In [26]:
with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('checks'))
    test_accs, wrong_indices = [], []
    for test_idx, test_x, test_y, test_names, _, _  in get_batches_test(X_valid, y_valid, sign_names, 
                                                                    valid_sizes, valid_coord, batch_size):
        feed = {model.x: test_x, 
                model.targets: test_y, 
                model.drop_rate: 0., 
                model.is_train: False}
        test_acc, test_cor = sess.run([model.accuracy, model.correct_pred], feed_dict=feed)
        test_accs.append(test_acc)
        wrong_idx = [test_idx[i] for i in range(len(test_cor)) if test_cor[i] == False]
        wrong_indices.append(wrong_idx)
    avg_test_acc = np.mean(test_accs)
    print('Validation Accuracy {:.4}'.format(avg_test_acc))
    print('Displaying validation samples...')
    num_images = len(X_valid)
    idx = np.arange(num_images)
    np.random.shuffle(idx)
    num_show = 5
    [view_val_with_preds(sess, X_valid[idx[i]], y_valid[idx[i]], sign_names[y_valid[idx[i]], 1], 
                         valid_sizes[idx[i]], valid_coord[idx[i]]) for i in range(num_show)]
    
wrong_indices = np.array([p for sublist in wrong_indices for p in sublist])
n_wrong = len(wrong_indices)
print('Total misclassified signs in validation set: {}'.format(n_wrong))
INFO:tensorflow:Restoring parameters from checks/tsigns.ckpt
Validation Accuracy 0.9709
Displaying validation samples...
Total misclassified signs in validation set: 128

Have a gander at some of the misclassified images

In [27]:
plt.figure(figsize=(45, 45))
for i in range(80):
    plt.subplot(8,10,(i+1))
    plt.title('{:.20}'.format(sign_names[y_valid[wrong_indices[i]], 1]), fontsize=22)
    plt.imshow(X_valid[wrong_indices[i]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')

Check accuracy on test set

I'll also track the true positives, true negatives, false positives, and false negatives, then calculate the precision, recall, and specificity for each class. This can help determine how to augment data by showing the network's weak labels.

In [28]:
tp = np.zeros(n_classes)
tn = np.zeros(n_classes)
fp = np.zeros(n_classes)
fn = np.zeros(n_classes)

with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('checks'))
    test_accs, wrong_indices = [], []
    for test_idx, test_x, test_y, test_names, _, _  in get_batches_test(X_test, y_test, sign_names, 
                                                                    test_sizes, test_coord, batch_size):
        feed = {model.x: test_x, 
                model.targets: test_y, 
                model.drop_rate: 0., 
                model.is_train: False}
        test_acc, test_preds, test_cor = sess.run([model.accuracy, model.preds, model.correct_pred], feed_dict=feed)
        test_preds = tf.argmax(test_preds, 1).eval()
        for i in range(len(test_cor)):
            if test_cor[i] == True:
                tp[test_y[i]] += 1
                for j in range(n_classes):
                    if j != test_y[i]:
                        tn[j] += 1
            if test_cor[i] == False:
                fp[test_preds[i]] += 1
                fn[y_test[i]] += 1
        
        test_accs.append(test_acc)
        wrong_idx = [test_idx[i] for i in range(len(test_cor)) if test_cor[i] == False]
        wrong_indices.append(wrong_idx)
    avg_test_acc = np.mean(test_accs)
    print('Test Accuracy {:.4}'.format(avg_test_acc))
    print('Displaying test samples...')
    num_images = len(X_test)
    idx = np.arange(num_images)
    np.random.shuffle(idx)
    num_show = 5
    [view_val_with_preds(sess, X_test[idx[i]], y_test[idx[i]], sign_names[y_test[idx[i]], 1], 
                         test_sizes[idx[i]], test_coord[idx[i]]) for i in range(num_show)]

wrong_indices = np.array([p for sublist in wrong_indices for p in sublist])
n_wrong = len(wrong_indices)
print('Total misclassified signs in test set: {}'.format(n_wrong))
print('')
precision = tp / (tp + fp)
recall = tp / (tp + fn)
specificity = tn / (tn + fp)
accuracy = np.sum(tp) / len(X_test)
print('Double-check accuracy: {:.4}'.format(accuracy))
print('')
for i in range(n_classes):
    print('{}:'.format(sign_names[i, 1]))
    print('     precision: {:.4}'.format(precision[i]))
    print('     recall: {:.4}'.format(recall[i]))
    print('     specificity: {:.4}'.format(specificity[i]))
    print('')
INFO:tensorflow:Restoring parameters from checks/tsigns.ckpt
Test Accuracy 0.9379
Displaying test samples...
Total misclassified signs in test set: 783

Double-check accuracy: 0.938

Speed limit (20km/h):
     precision: 0.8657
     recall: 1.0
     specificity: 0.9992

Speed limit (30km/h):
     precision: 0.9461
     recall: 0.9338
     specificity: 0.9963

Speed limit (50km/h):
     precision: 0.9426
     recall: 1.0
     specificity: 0.996

Speed limit (60km/h):
     precision: 0.9684
     recall: 0.9555
     specificity: 0.9988

Speed limit (70km/h):
     precision: 0.9815
     recall: 0.922
     specificity: 0.9989

Speed limit (80km/h):
     precision: 0.9259
     recall: 0.9623
     specificity: 0.9958

End of speed limit (80km/h):
     precision: 1.0
     recall: 1.0
     specificity: 1.0

Speed limit (100km/h):
     precision: 0.9699
     recall: 0.8915
     specificity: 0.9989

Speed limit (120km/h):
     precision: 0.9952
     recall: 1.0
     specificity: 0.9998

No passing:
     precision: 0.9955
     recall: 0.8402
     specificity: 0.9998

No passing for vehicles over 3.5 metric tons:
     precision: 0.9877
     recall: 0.9596
     specificity: 0.9993

Right-of-way at the next intersection:
     precision: 0.926
     recall: 0.8394
     specificity: 0.9971

Priority road:
     precision: 0.9183
     recall: 0.9404
     specificity: 0.9948

Yield:
     precision: 0.9658
     recall: 0.9645
     specificity: 0.9978

Stop:
     precision: 0.96
     recall: 1.0
     specificity: 0.9991

No vehicles:
     precision: 0.9951
     recall: 1.0
     specificity: 0.9999

Vehicles over 3.5 metric tons prohibited:
     precision: 0.9091
     recall: 0.8772
     specificity: 0.9987

No entry:
     precision: 0.9901
     recall: 0.9373
     specificity: 0.9997

General caution:
     precision: 0.8864
     recall: 0.9369
     specificity: 0.9965

Dangerous curve to the left:
     precision: 0.9138
     recall: 1.0
     specificity: 0.9996

Dangerous curve to the right:
     precision: 0.6698
     recall: 0.7172
     specificity: 0.997

Double curve:
     precision: 0.6911
     recall: 0.8095
     specificity: 0.9968

Bumpy road:
     precision: 0.7926
     recall: 1.0
     specificity: 0.9976

Slippery road:
     precision: 0.8133
     recall: 0.7771
     specificity: 0.9976

Road narrows on the right:
     precision: 0.8913
     recall: 1.0
     specificity: 0.9992

Road work:
     precision: 0.9259
     recall: 0.9557
     specificity: 0.9967

Traffic signals:
     precision: 0.924
     recall: 1.0
     specificity: 0.9989

Pedestrians:
     precision: 0.5769
     recall: 0.5085
     specificity: 0.9981

Children crossing:
     precision: 0.9648
     recall: 1.0
     specificity: 0.9996

Bicycles crossing:
     precision: 0.7909
     recall: 1.0
     specificity: 0.998

Beware of ice/snow:
     precision: 0.9412
     recall: 1.0
     specificity: 0.9994

Wild animals crossing:
     precision: 0.9923
     recall: 1.0
     specificity: 0.9998

End of all speed and passing limits:
     precision: 1.0
     recall: 1.0
     specificity: 1.0

Turn right ahead:
     precision: 0.9806
     recall: 0.8016
     specificity: 0.9997

Turn left ahead:
     precision: 0.9915
     recall: 1.0
     specificity: 0.9999

Ahead only:
     precision: 0.9551
     recall: 0.9504
     specificity: 0.9984

Go straight or right:
     precision: 0.9915
     recall: 1.0
     specificity: 0.9999

Go straight or left:
     precision: 0.8906
     recall: 1.0
     specificity: 0.9994

Keep right:
     precision: 0.9865
     recall: 0.9179
     specificity: 0.9992

Keep left:
     precision: 0.9032
     recall: 1.0
     specificity: 0.9992

Roundabout mandatory:
     precision: 0.7288
     recall: 1.0
     specificity: 0.9973

End of no passing:
     precision: 0.5413
     recall: 1.0
     specificity: 0.9958

End of no passing by vehicles over 3.5 metric tons:
     precision: 0.7564
     recall: 1.0
     specificity: 0.9984

Some more misclassified images, this time from the test set

In [29]:
plt.figure(figsize=(45, 45))
for i in range(100):
    plt.subplot(10,10,(i+1))
    plt.title('{:.20}'.format(sign_names[y_test[wrong_indices[i+100]], 1]), fontsize=22)
    plt.imshow(X_test[wrong_indices[i+100]])
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')

Let's see how the network performs with new images found on the web

In [30]:
eg1 = normalize(cv2.resize(mpimg.imread('traffic-signs-web/example_1.jpg'), dsize=(32,32)))
eg2 = normalize(cv2.resize(mpimg.imread('traffic-signs-web/example_2.jpg'), dsize=(32,32)))
eg3 = normalize(cv2.resize(mpimg.imread('traffic-signs-web/example_4.jpg'), dsize=(32,32)))
eg4 = normalize(cv2.resize(mpimg.imread('traffic-signs-web/example_5.jpg'), dsize=(32,32)))
eg5 = normalize(cv2.resize(mpimg.imread('traffic-signs-web/example_6.jpg'), dsize=(32,32)))
egs = [eg1, eg2, eg3, eg4, eg5]
plt.figure(figsize=(15,5))
for i in range(5):
    plt.subplot(1,5,(i+1))
    plt.imshow(egs[i])
In [31]:
def view_web_with_preds(sess, image, top_n=how_many):
    feed = {model.x: image.reshape((1,32,32,-1)), 
            model.drop_rate: 0., 
            model.is_train: False}
    pred = sess.run(model.preds, feed_dict=feed)
    top_n_pred_names = top_n_predictions(pred)
    top_n_pred_probs = top_n_predictions(pred, probs_off=False)
    
    plt.figure(figsize=(10, 8))
    plt.subplot(2,2,1)
    y_pos = np.arange(top_n)
    probabilities = np.flip(top_n_pred_probs, 0)
    plt.barh(y_pos, probabilities, align='center', color='blue', tick_label=np.flip(top_n_pred_names, 0))
    plt.xlabel('Probability')
    
    plt.subplot(2,2,2)
    plt.imshow(image)
    plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off')
        
    plt.subplots_adjust(wspace=0.75)
    plt.show()
    
    return np.flip(probabilities, 0), top_n_pred_names
In [32]:
with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('checks'))
    for i in range(5):
        probs, top_n_names = view_web_with_preds(sess, egs[i])
        print('Top 5 Softmax Probabilities:')
        [print('     {}: {:.4}'.format(top_n_names[i], probs[i])) for i in range(5)]
INFO:tensorflow:Restoring parameters from checks/tsigns.ckpt
Top 5 Softmax Probabilities:
     Roundabout mandatory: 1.0
     Speed limit (20km/h): 0.0
     Speed limit (30km/h): 0.0
     Speed limit (50km/h): 0.0
     Speed limit (60km/h): 0.0
Top 5 Softmax Probabilities:
     Yield: 1.0
     Ahead only: 6.239e-34
     Speed limit (20km/h): 0.0
     Speed limit (30km/h): 0.0
     Speed limit (50km/h): 0.0
Top 5 Softmax Probabilities:
     Ahead only: 1.0
     Speed limit (20km/h): 0.0
     Speed limit (30km/h): 0.0
     Speed limit (50km/h): 0.0
     Speed limit (60km/h): 0.0
Top 5 Softmax Probabilities:
     Turn right ahead: 1.0
     Speed limit (20km/h): 0.0
     Speed limit (30km/h): 0.0
     Speed limit (50km/h): 0.0
     Speed limit (60km/h): 0.0
Top 5 Softmax Probabilities:
     Speed limit (60km/h): 1.0
     Speed limit (50km/h): 1.222e-34
     Speed limit (20km/h): 0.0
     Speed limit (30km/h): 0.0
     Speed limit (70km/h): 0.0

Crushing it! Now let's check a sign from the web that had low precision and recall on the test set, 'Dangerous Curve to Right'

In [33]:
print('{}:'.format(sign_names[20, 1]))
print('     precision: {:.4}'.format(precision[20]))
print('     recall: {:.4}'.format(recall[20]))
print('     specificity: {:.4}'.format(specificity[20]))

dang_curve_to_right = normalize(cv2.resize(mpimg.imread('traffic-signs-web/dangerous_curve_to_right.jpg'), dsize=(32,32)))
dang_curve_to_right2 = normalize(cv2.resize(mpimg.imread('traffic-signs-web/dangerous_curve_to_right2.jpg'), dsize=(32,32)))

with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('checks'))
    probs, top_n_names = view_web_with_preds(sess, dang_curve_to_right)
    print('Top 5 Softmax Probabilities:')
    [print('     {}: {:.4}'.format(top_n_names[i], probs[i])) for i in range(5)]
    
    probs, top_n_names = view_web_with_preds(sess, dang_curve_to_right2)
    print('Top 5 Softmax Probabilities:')
    [print('     {}: {:.4}'.format(top_n_names[i], probs[i])) for i in range(5)]
Dangerous curve to the right:
     precision: 0.6698
     recall: 0.7172
     specificity: 0.997
INFO:tensorflow:Restoring parameters from checks/tsigns.ckpt
Top 5 Softmax Probabilities:
     Road work: 1.0
     Speed limit (20km/h): 0.0
     Speed limit (30km/h): 0.0
     Speed limit (50km/h): 0.0
     Speed limit (60km/h): 0.0
Top 5 Softmax Probabilities:
     Ahead only: 1.0
     General caution: 3.521e-22
     Traffic signals: 3.932e-26
     Speed limit (20km/h): 0.0
     Speed limit (30km/h): 0.0

Well, at least the miss was predictable.

Finally, have a look at the network's activation output to see how it's learning

1) On Roundabout Mandatory from web

In [34]:
with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('checks'))
    feed = {model.x: egs[0].reshape((1,32,32,-1)), 
            model.drop_rate: 0., 
            model.is_train: False}
    relu1, relu2 = sess.run([model.relu1, model.relu2], feed_dict=feed)
    
    plt.figure(figsize=(5,5))
    plt.imshow(egs[0])
    plt.title('Original Image')
    
    plt.figure(figsize=(35,35))
    plt.suptitle('ReLU 1', fontsize=45, y=0.91)
    for i in range(64):
        plt.subplot(8,8,(i+1))
        plt.imshow(relu1[0, :, :, i], interpolation='nearest', cmap='gray')
        plt.title('FeatureMap #{}'.format(i))
        
    plt.figure(figsize=(35,35))
    plt.suptitle('ReLU 2', fontsize=45, y=0.91)
    for i in range(64):
        plt.subplot(8,8,(i+1))
        plt.imshow(relu2[0, :, :, i], interpolation='nearest', cmap='gray')
        plt.title('FeatureMap #{}'.format(i))
INFO:tensorflow:Restoring parameters from checks/tsigns.ckpt

2) On 60km/h from web

In [35]:
with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('checks'))
    feed = {model.x: egs[-1].reshape((1,32,32,-1)), 
            model.drop_rate: 0., 
            model.is_train: False}
    relu1, relu2 = sess.run([model.relu1, model.relu2], feed_dict=feed)
    
    plt.figure(figsize=(5,5))
    plt.imshow(egs[-1])
    plt.title('Original Image')
    
    plt.figure(figsize=(35,35))
    plt.suptitle('ReLU 1', fontsize=45, y=0.91)
    for i in range(64):
        plt.subplot(8,8,(i+1))
        plt.imshow(relu1[0, :, :, i], interpolation='nearest', cmap='gray')
        plt.title('FeatureMap #{}'.format(i))
        
    plt.figure(figsize=(35,35))
    plt.suptitle('ReLU 2', fontsize=45, y=0.91)
    for i in range(64):
        plt.subplot(8,8,(i+1))
        plt.imshow(relu2[0, :, :, i], interpolation='nearest', cmap='gray')
        plt.title('FeatureMap #{}'.format(i))
INFO:tensorflow:Restoring parameters from checks/tsigns.ckpt

3) On Dangerous Curve to Right from web

Keeping in mind how this sign had low precision and recall, notice how the network has trouble recognizing the relevant line that distinguishes it from other triangular street signs.

In [36]:
with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('checks'))
    feed = {model.x: dang_curve_to_right2.reshape((1,32,32,-1)), 
            model.drop_rate: 0., 
            model.is_train: False}
    relu1, relu2 = sess.run([model.relu1, model.relu2], feed_dict=feed)
    
    plt.figure(figsize=(5,5))
    plt.imshow(dang_curve_to_right2)
    plt.title('Original Image')
    
    plt.figure(figsize=(35,35))
    plt.suptitle('ReLU 1', fontsize=45, y=0.91)
    for i in range(64):
        plt.subplot(8,8,(i+1))
        plt.imshow(relu1[0, :, :, i], interpolation='nearest', cmap='gray')
        plt.title('FeatureMap #{}'.format(i))
        
    plt.figure(figsize=(35,35))
    plt.suptitle('ReLU 2', fontsize=45, y=0.91)
    for i in range(64):
        plt.subplot(8,8,(i+1))
        plt.imshow(relu2[0, :, :, i], interpolation='nearest', cmap='gray')
        plt.title('FeatureMap #{}'.format(i))
INFO:tensorflow:Restoring parameters from checks/tsigns.ckpt

4) On Van Gogh's Siesta

Because why not?

In [37]:
van_gogh = normalize(cv2.resize(mpimg.imread('traffic-signs-web/van_gogh.jpg'), dsize=(32,32)))
van_gogh_orig = mpimg.imread('traffic-signs-web/van_gogh.jpg')
with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('checks'))
    feed = {model.x: van_gogh.reshape((1,32,32,-1)), 
            model.drop_rate: 0., 
            model.is_train: False}
    relu1, relu2 = sess.run([model.relu1, model.relu2], feed_dict=feed)
    
    plt.figure(figsize=(5,5))
    plt.imshow(van_gogh_orig)
    plt.title('Original Image')
    
    plt.figure(figsize=(35,35))
    plt.suptitle('ReLU 1', fontsize=45, y=0.91)
    for i in range(64):
        plt.subplot(8,8,(i+1))
        plt.imshow(relu1[0, :, :, i], interpolation='nearest', cmap='gray')
        plt.title('FeatureMap #{}'.format(i))
        
    plt.figure(figsize=(35,35))
    plt.suptitle('ReLU 2', fontsize=45, y=0.91)
    for i in range(64):
        plt.subplot(8,8,(i+1))
        plt.imshow(relu2[0, :, :, i], interpolation='nearest', cmap='gray')
        plt.title('FeatureMap #{}'.format(i))
INFO:tensorflow:Restoring parameters from checks/tsigns.ckpt